Hi,
How do you define the from field in the email. The From field shows eg hcanning2008@p3nxyz13.shr.prod.phx3.secureserver.net from hcanning2008.
Can I set it up so it reads feedback@mywebsite.com from Website Feedback?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had to do some tweaking to the processor.php file but it works great! I believe I removed the top line with the 'server name' in it and moved the mail part to the bottom. I put in $message=" at the top and in the mail section. And then in the mail section in the bottom add $message too.
I hope that makes sense. :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2009-11-20
I didn't even see the reply above mine. That works too!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm having issues with this to. I tried following the instructions on this post and spent almost 1 hour searching the internet for solutions on this same issue and everyone is saying the same thing that is being suggested on here.
If someone can please simplify it for me and break it down step by step on what's the simplest way to have the "**from email address**" be the email address the user entered in the form. Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry for the double post, but that's the code I'm working with in my **processor.php**. I'm not sure how to incorporate the examples into my code. I tried to include *example 2* into my code, but it did not work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I used your code, but it still did not work, it just took me to a blank page. What if I try doing what **laisunshine** said and remove the top line with the 'server name' in it, you think that will then make your code work?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So if I use example 2, whoever is filling out the form, their email will appear in the from field? I tried this and only the email that is in the "from" appears. In this case the webmaster@example.com appears.
You obviously have to know which form field you want to use, then insert the form field value into the "From" field in the example.
$headers = "From: ".$whatever_form_field_value." . "\r\n" .
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
How do you define the from field in the email. The From field shows eg hcanning2008@p3nxyz13.shr.prod.phx3.secureserver.net from hcanning2008.
Can I set it up so it reads feedback@mywebsite.com from Website Feedback?
Thanks
Follow example 2 at this link.
http://www.w3schools.com/PHP/func_mail_mail.asp
Excellent ..thank you.... I needed this as well. Should have been a no brainer.
This website helped me.
http://www.cyberciti.biz/faq/howto-change-from-email-address-php-mail-function/
I had to do some tweaking to the processor.php file but it works great! I believe I removed the top line with the 'server name' in it and moved the mail part to the bottom. I put in $message=" at the top and in the mail section. And then in the mail section in the bottom add $message too.
I hope that makes sense. :)
I didn't even see the reply above mine. That works too!
Hi guys,
I'm having issues with this to. I tried following the instructions on this post and spent almost 1 hour searching the internet for solutions on this same issue and everyone is saying the same thing that is being suggested on here.
If someone can please simplify it for me and break it down step by step on what's the simplest way to have the "**from email address**" be the email address the user entered in the form. Thank you.
It's hard to get much clearer than this "Example #2".
http://php.net/manual/en/function.mail.php
<?php $where_form_is="http://".$_SERVER.strrev(strstr(strrev($_SERVER),"/"));session_start();
if( ($_SESSION==$_POST) && (!empty($_POST)) ) {mail("webmaster@mydomain.com","Contact - Form Submission","Form data:
Name:: " . $_POST . "
Email:: " . $_POST . "
Message:: " . $_POST);include("confirm.html");
}
else {
echo "Invalid Verification Security Code. Please go back and try again.";}?>
<?php $where_form_is="http://".$_SERVER.strrev(strstr(strrev($_SERVER),"/"));session_start();
if( ($_SESSION==$_POST) && (!empty($_POST)) ) {mail("webmaster@mydomain.com","Contact - Form Submission","Form data:
Name:: " . $_POST . "
Email:: " . $_POST . "
Message:: " . $_POST);include("confirm.html");
}
else {
echo "Invalid Verification Security Code. Please go back and try again.";}?>
Sorry for the double post, but that's the code I'm working with in my **processor.php**. I'm not sure how to incorporate the examples into my code. I tried to include *example 2* into my code, but it did not work.
<?php
sessionstart();
$whereformis="http://".$SERVER.strrev(strstr(strrev($SERVER),"/"));
if( ($SESSION==$POST) && (!empty($POST)) ) {
$to = 'webmaster@mydomain.com';
$subject = 'Contact - Form Submission';
$message = "Form data: Name: " . $POST . " Email: " . $POST . " Message: " . $POST;
$headers = 'From: ".$POST."' . "\r\n" .
'Reply-To: webmaster@mydomain.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
include("confirm.html");
} else {
echo "Invalid Verification Security Code. Please go back and try again.";
}
?>
Hi tnteveret1,
I used your code, but it still did not work, it just took me to a blank page. What if I try doing what **laisunshine** said and remove the top line with the 'server name' in it, you think that will then make your code work?
tnteveret1 did you ever write a tutorial for this? Cuz, people ask this a lot. I will look into it but I never really tried to find out.
What if I don't want my email to appear? Can I set it up so that the customer's email appears instead? Thanks!
Follow example 2 at this link.
http://www.w3schools.com/PHP/func_mail_mail.asp
So if I use example 2, whoever is filling out the form, their email will appear in the from field? I tried this and only the email that is in the "from" appears. In this case the webmaster@example.com appears.
$headers = "From: webmaster@example.com" . "\r\n" .
You obviously have to know which form field you want to use, then insert the form field value into the "From" field in the example.
$headers = "From: ".$whatever_form_field_value." . "\r\n" .
RESOLVED
Do following in processor.php
replace:
");
include("yourconfirmationpage.html");
with
","from: website_query@yourwebsite.com" );
include("yourconfirmationpage.html");
////paste it in from notepad. Its a bit tempermental pasting. Works perfect. Stops me getting the server generated from email "H-Sphere Httpd Daemon "
Hope this helps!