使用自动响应扩展联系表单

时间:2016-04-20 20:31:10

标签: php forms contact

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

<?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!");
?>

如何将其扩展为向使用自定义文字提交条目的人发送电子邮件?喜欢&#34;感谢您的留言。我们会在接下来的48小时内回复您。&#34;

谢谢!

2 个答案:

答案 0 :(得分:0)

你能不能把它们添加到CC标题中?

Sub name()

Dim arr() As String
Dim lastRow As Long
c = 2

With ActiveSheet

    lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

    For i = 1 To lastRow

        arr = Split(.Cells(i, 1), " ")

        For Each e In arr
            .Cells(i, c).Value = arr(e)
            c = c + 1
        Next

        Set arr = Empty

    Next

End With

End Sub

答案 1 :(得分:0)

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

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

$ToEmail接受多个。希望它也会起作用。