使用自动回复扩展联系表单


Extend Contact Form with Autoresponse

我在我的网站上使用以下联系表格:

<?php
    if ($_POST["email"]<>'') {
        $ToEmail = 'info@mysite.com';
        $EmailSubject = 'Message from Website';
        $mailheader = "From: ".$_POST["email"]."'r'n";
        $mailheader .= "Reply-To: ".$_POST["email"]."'r'n";
        $mailheader .= "Content-type: text/html; charset=utf-8'r'n";
        $MESSAGE_BODY = "Name: ".$_POST["name"]."<br /><br />";
        $MESSAGE_BODY .= "Email: ".$_POST["email"]."<br /><br />";
        $MESSAGE_BODY .= "Birthday: ".$_POST["birthday"]."<br /><br /><br />";
        $MESSAGE_BODY .= "Message:<br /><br />".nl2br($_POST["comments"])."";
        mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Fehler!");
?>

如何扩展它以向提交带有自定义文本的条目的人发送电子邮件?像"谢谢你的留言。我们将在接下来的48小时内回复您。

谢谢!

您不能将它们添加到 CC 标头中吗?

$mailheader .= "CC: ".$_POST["email"]."'r'n";

您可以在以下行中使用多个电子邮件地址:

$ToEmail = 'info@mysite.com, another_email@email.com';

$ToEmail接受多个。希望它也能工作。