【发布时间】:2014-07-19 17:30:12
【问题描述】:
我目前有两个问题:
在我的 gmail 中,发件人:标头不尊重“我的联系表单”名称。它默认为其他内容。
当我在 gmail 中收到电子邮件时,它当然是从
myemail@mydomain.com发送的(以避免垃圾邮件文件夹),但是当我点击回复时,我希望它使用联系表单用户的 $email,不是myemail@mydomain.com
我确定我遗漏了一些细节,所以如果我遗漏了什么,请告诉我,我会添加它。
这是我的代码:
if (!isset($_REQUEST['name']) || !isset($_REQUEST['email']) || !isset($_REQUEST['message'])) {
die();
}
// PHP parameters
$to = "myemail@gmail.com";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
// Subject
$email_subject = $_POST['name'] . ' ' . 'is contacting you from mywebsite.com' . '!';
// body of email
$body = ""
$body = wordwrap($body, 60, "\n");
// Headers
$headers .= "From: My contact form <myemail@mydomain.com>" . "\r\n";
$headers .= "Reply-To: $email" . "\r\n";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers .= "Return-Path: myemail@mydomain.com" . "\r\n";
$headers .= "X-Mailer: PHP". phpversion() ."\r\n";
// Mail it
mail( $to, $email_subject, $body, $headers, "-fmyemail@mydomain.com" );
【问题讨论】:
标签: php email contact-form email-headers