【问题标题】:Automatic Email reply自动电子邮件回复
【发布时间】:2014-03-27 14:11:20
【问题描述】:

我想向填写了我的联系表的客户发送一封自动电子邮件。填写表格后,它会将表格的值发送给我,但不会将电子邮件发送回联系人。这就是我目前所拥有的。

$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);

?>

【问题讨论】:

  • 我没有看到您尝试发送第二封电子邮件。
  • 所以只需添加第二个 mail() 将其发送给客户...?
  • 旁注:您的$headers 完全错误。
  • 感谢 Tularis 现在整理好了。就是你说的。
  • @Gerald Schneider 为什么他们错了?

标签: php email


【解决方案1】:

您只需在代码末尾添加即可:

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

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

【讨论】:

    【解决方案2】:

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

    $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 );
    

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

    【讨论】:

      猜你喜欢
      • 2017-08-24
      • 1970-01-01
      • 2011-05-04
      • 2020-05-25
      • 2012-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多