Send User Copy to his Email #Contact Form #PHP Script
this is related to contact form. i am trying to send a copy of email to
user also.
so i thought to replace the same function so i repeated
if(!isset($hasError)) second time and changing $emailTo = $email
and this is not working. i thing the problem might with the headers... can
i write 2 different header tags ?
// to me
if(!isset($hasError)) {
$emailTo = 'myemail@website.com';
$subject = 'Submitted message from '.$name;
$sendCopy = trim($_POST['sendCopy']);
$body = "Name: $name \n\nEmail: $email \n\nComments: $comments";
$headers = 'From: ' .' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' .
$email;
mail($emailTo, $subject, $body, $headers);
$emailSent = true;
}
//User Copy
if(!isset($hasError)) {
$EmailTo = '$email';
$Subject = 'Thank you for Contacting';
$Body = "Here is your copy of email which you have sent us. \n\nName:
$name \n\nEmail: $email \n\nComments: $comments \n\n Thank you for
your email. we will get back to your soon";
$headers = 'From: ' .' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
mail($emailTo, $subject, $body, $headers);
$UserEmailSent = true;
}
UPDATE: how to change the sender email id ? i want to change the sender
email id to noreply@example.com. now it showing i got message from myself
:O
No comments:
Post a Comment