I have seen this topic discuss in great detail on the forum however I am still unable to get my form to show the email address of the sender in the 'from' heading. It currently shows server details.
I need this so that I can use the 'reply' button to reply directly to people who submit the form to my site.
I've never seen it done this way and I don't think you can modify the header successfully with only partial information. The best source for learnig how this can be accomplished is here: http://php.net/manual/en/function.mail.php
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have another scirpt that I use and on this script I get what I want (the 'from' heading showing the senders email address).
I have tried to follow the instrcutions as per the link that you have provided and I still cant get it to work.
Here is the script where it does work:
<?phpfunctiondied($error){// your error code can go hereecho"We are very sorry, but there were error(s) found with the information you submitted. ";echo"These errors are as follows:<br /><br />";echo$error."<br /><br />";echo"Please click on the back button and fix these errors.<br /><br />";die();}functionclean_string($string){$bad=array("content-type","bcc:","to:","cc:","href");returnstr_replace($bad,"",$string);}if(isset($_POST['email'])){// EDIT THE 2 LINES BELOW AS REQUIRED$email_to="******@*******.co.uk";$email_subject="Enquiry";// validation expected data existsif(!isset($_POST['name'])||!isset($_POST['email'])||!isset($_POST['Inquiry'])){died('We are sorry, but there appears to be a problem with the information you submitted.');}$name=$_POST['name'];// required$email_from=$_POST['email'];// required$Inquiry=$_POST['Inquiry'];// required$error_message="";$email_exp="^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";$string_exp="^[a-z .'-]+$";if(!eregi($string_exp,$name)){$error_message.='The Name you entered does not appear to be valid.<br />';}if(!eregi($email_exp,$email_from)){$error_message.='The Email Address you entered does not appear to be valid.<br />';}if(strlen($Inquiry)<10){$error_message.='The Enquiry you entered does not appear to be valid.<br />';}if(strlen($error_message)>0){died($error_message);}$email_message="\n\n";$email_message.="Name: ".clean_string($name)."\n";$email_message.="Email: ".clean_string($email_from)."\n";$email_message.="Enquiry: ".clean_string($Inquiry)."\n";// create email headers$headers='From: '.$email_from."\r\n".'Reply-To: '.$email_from."\r\n".'X-Mailer: PHP/'.phpversion();@mail($email_to,$email_subject,$email_message,$headers);?>
Regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have seen this topic discuss in great detail on the forum however I am still unable to get my form to show the email address of the sender in the 'from' heading. It currently shows server details.
I need this so that I can use the 'reply' button to reply directly to people who submit the form to my site.
The code that I have is as follows:
$where_form_is="http://".$_SERVER.strrev(strstr(strrev($_SERVER),"/"));
session_start();
if( ($_SESSION==$_POST) && (!empty($_POST)) ) {
mail("??????????@????????.co.uk","Enrollment Form","ENROLLMENT DETAILS:
Full Name: " . $_POST . "
Address (Including Postcode): " . $_POST . "
Mobile Number: " . $_POST . "
Your Email Address: " . $_POST . "
How did you hear about the MADE Academy?: " . $_POST . "
Childs Full Name: " . $_POST . "
Childs Date of Birth: " . $_POST . "
Preferred Start Date: " . $_POST . "
Experience: " . $_POST . "
Would you like to be considered for the agency?: " . $_POST . "
Do you give permission for your childs photograph to be taken in class and used?: " . $_POST . "
","from: enrol@madeacademy.co.uk" );
include("confirm.html");
}
else {
echo "Invalid Captcha String.";
}
?>
If anyone can give me some very simple step by step instructions on how I can achieve this I would be most gratefull.
Regards
I've never seen it done this way and I don't think you can modify the header successfully with only partial information. The best source for learnig how this can be accomplished is here:
http://php.net/manual/en/function.mail.php
Thank you for the reply.
I have another scirpt that I use and on this script I get what I want (the 'from' heading showing the senders email address).
I have tried to follow the instrcutions as per the link that you have provided and I still cant get it to work.
Here is the script where it does work:
Regards
Turns out I have used this method before. Here is an old example in a form that is still working.
"mail("mypersonalemail@comcast.net","Form Submitted by $FirstName $LastName",$message,"From: $Email");"
Try capitolizing the "From:" and substitute the raw email address with a variable.
$Email=$_POST;
then
","From: $Email" );
Thanks for the reply.
I have sorted this now by replacing:
with
with