我尝试了几个人的答案,没有人工作。我有一个很好的工作phpmail函数,我只想添加一个autorespond函数,以便发件人可以立即通知收到提交。
我的代码是:
<?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");
}
}
?>
我想在autorespond中说出类似的内容:
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
答案 0 :(得分: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");
}
}
?>