自动电邮回复

时间:2014-03-27 14:11:20

标签: php email

我想向已填写联系表单的客户发送自动电子邮件。填写表单时,它会将表单的值发送给我,但不会向联系人发回电子邮件。这是我到目前为止所做的。

$name = $_POST["fullname"];
$email = $_POST["emailaddress"];
$comments = $_POST["comment"];
$gender = $_POST["gender"];
$age = $_POST["age"];
$Interested = $_POST['Interested'];
$heard = $_POST["Heard"];


$message = "New Email from a customer" .



         "\r\nName of the contact" .
         "\r\n-". $name .
         "\r\nEmail address of the contact" . 
         "\r\n-".$email .
         "\r\nThe comment that the contact has made" . 
         "\r\n-".$comments .
         "\r\nThe gender of the contact" . 
         "\r\n-".$gender .
         "\r\nThe age range of the contact" . 
         "\r\n-".$age .
         "\r\nThe products that the customer is interested in" . 
         "\r\n-".implode(", " ,$Interested).
         "\r\nWhere the contact heard of us"  .
         "\r\n-".$Heard.
 $headers =  "From: " . $email;
 "Reply-To: \r\n" . $email . " Thank you for your message";

mail("me@localhost",$subject,$message,$headers);

?>

2 个答案:

答案 0 :(得分:2)

您只需在代码末尾添加:

$subjectReply = 'Thank you for your contact..';
$messageReply = 'You will soon receive an answer';
$headers = 'From: me@localhost';

mail($email, $subjectReply, $messageReply, $headers);

答案 1 :(得分:0)

您需要做的就是向填写联系表格的人发​​送第二封电子邮件:

$message = "Thanks for getting in touch. We'll be in contact with you soon";
$reply_headers =  "From: me@localhost;";

mail( $email, "Thank you for contacting us", $reply_message, $reply_headers );

您尝试设置的回复标题不是自动回复标题。这是回复电子邮件的电子邮件地址。