PHP Code email Autoreply Help please

i have a page in my website with PHP , that do a customer comment and it send me an emails for those comments , and then send an automatic email to the customer , but my only problem is that i want the customer to receive the email as it is from the email i got my emails on , but when the customer received the email it received as my username in my host site @ hostsite.com

i want to solve this please thanks.

here is the code :

<?php require_once('recaptchalib.php'); $errFlag=0; $showForm=1; //KEEP YOUR PRIVATE KEY HERE $privatekey = ""; // <is_valid) { // What happens when the CAPTCHA was entered incorrectly $errMsg[]="The CAPTCHA wasn't entered correctly. Please try it again."; } if(empty($errMsg)) { // if there is no error then send a mail $ToEmail = '[email protected]'; // CHANGE YOUR EMAIL WHERE YOU WANT TO RECEIVE THE CONTACT FORM SUBMITTED BY USERS... $EmailSubject = 'Customer Comments '; $mailheader = "From: ".$email."\r\n"; $mailheader .= "Reply-To: ".$email."\r\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $MESSAGE_BODY = "Name: ".$name." ".$lname."
"; $MESSAGE_BODY .= "Phone: ".$phone."
"; $MESSAGE_BODY .= "Email: ".$email."
"; $MESSAGE_BODY .= "Comment: ".nl2br($message)."
"; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); if(mail) { $msg="Thank your for submitting the form, we will contact your shortly."; $showForm=0; mail($email, "Thank your for submitting.", $msg); } else { $msg="Some errors occured, please try again in a while."; } } else { $errFlag=1; } } ?> Customer Comments /* error and success msg */ #errMsg { background-color:#febbbb; border:1px solid #d31a1c; color:#d31a1c; font-size:12px; padding:10px; margin-bottom:15px;} #successMsg { background-color:#ffffff; border:1px solid #ffffff; color:#000000; font-size:16px; padding:10px; margin-bottom:15px; margin-top:25px;} #contact_form { position: absolute; width: 888px; height: 365px; z-index: 1; left: 190px; top: 128px;} #contact_form form label { display:block;} contact_form p { margin-bottom:10px;} .auto-style1 { font-family: "Times New Roman", Times, serif; font-weight: bold; color: #FFFFFF; }

 

 

 

 

 

 

 

       

 

 

 

 

 

<?php if($errFlag) { echo "
"; foreach($errMsg as $val) { echo "- "; echo $val; echo "
"; } echo "
"; } ?> <?php if($showForm){ ?>

First Name

Last Name

Phone Number

Email Address

Customer Comments <?php if (isset($_POST['message'])) echo $_POST['message']; ?>

<?php //PUT YOUR PUBLIC KEY HERE $publickey = ""; // <

<?php } else { ?>
Thanks for your comments and questions we appreciate that you took the time to send us..
<?php }?>

change the line:

[php]mail($email, “Thank your for submitting.”, $msg);[/php]

to:

[php]
$headers = “From: [email protected]”;
mail($email, “Thank your for submitting.”, $msg, $headers);
[/php]

Change the ‘$headers’ variable to the email address you want the email to say its from, then the email the customer will receive says its from (e.g.) [email protected]

Sponsor our Newsletter | Privacy Policy | Terms of Service