这与联系表格有关。我也试图向用户发送电子邮件副本。
所以我想替换相同的功能,所以我第二次重复if(!isset($hasError))
并改变$emailTo = $email
这不起作用。我的问题可能与标题...我可以写2个不同的标题标签?
// 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;
}