-1

我已经尝试了几个人的答案,没有一个有效。我有一个运行良好的 phpmail 功能,我只想为其添加一个自动回复功能,以便可以立即通知发件人已收到提交。

我的代码是这样的:

    <?php
        $mail_to_send_to = "contact@matejkadesign.com";
        $your_feedbackmail = "form@matejkadesign.com";


        $sendflag = $_REQUEST['sendflag'];
        if ( $sendflag == "send" )
        {
                $name = $_REQUEST['name'] ;
                $email = $_REQUEST['email'] ;
                $message = $_REQUEST['message'] ;
                $headers = "From: $your_feedbackmail" . "\r\n" . "Reply-To: $name <$email>" . "\r\n" ;
                $a = mail( $mail_to_send_to, "Contact request", $message, $headers );
                if ($a) 
                {
                    print("Message sent, thank you! You can send another");
                } else {
                    print("Message wasn't sent, please check that your email was filled in properly");
                }
        }
?>

我想在自动回复中这样说:

Thank you for contacting us. This is an automatically generated reply confirming your submission. We will get back to you as soon as possible.

Sincerely,
John Doe
4

1 回答 1

0

这不是你想要的,但我做了一个疯狂的猜测。当他/她使用此表单时,您想给用户发送电子邮件。使用此代码:

<?php

$mail_to_send_to = "contact@matejkadesign.com";
$your_feedbackmail = "form@matejkadesign.com";


$sendflag = $_REQUEST['sendflag'];

if ( $sendflag == "send" ) {
    $name = $_REQUEST['name'] ;
    $email = $_REQUEST['email'] ;
    $message = $_REQUEST['message'] ;
    $headers = "From: $your_feedbackmail" . "\r\n" . "Reply-To: $name <$email>" . "\r\n" ;
    $a = mail( $mail_to_send_to, "Contact request", $message, $headers );
    if ($a) 
    {
        print("Message sent, thank you! You can send another");
        $message_back = "Thank you for contacting us. This is an automatically generated reply confirming your submission. We will get back to you as soon as possible.";
        mail( $email, "Contact request", $message_back, $headers );
    } else {
        print("Message wasn't sent, please check that your email was filled in properly");
    }
}

?>
于 2013-03-01T23:39:12.653 回答