[英]Why do my “From” and “Reply-To” headers keep getting included in my mail sent from PHP?
I have this code for sending mail in PHP: 我有以下代码用于在PHP中发送邮件:
$headers = "Content-type: text/html;\r\n";
$headers .= 'From: "Registration" <registration@site.com>' . "\r\n";
$headers .= "Reply-To: registration@site.com\r\n";
$headers .= "Return-Path: registration@site.com\r\n";
$mailresult = mail($to, $subject, $message, $headers, '-f registration@site.com');
The mail sends, the from address is set correctly, and it's working almost perfectly. 邮件发送完毕,发件人地址设置正确,并且工作正常。
The problem is that the mail includes the From:
, Reply-To:
, and Return-Path:
fields in the body of the mail. 问题在于该邮件在邮件正文中包含“
From:
,“ Reply-To:
”和“ Return-Path:
字段。 Here is a snapshot of what it looks like in my Gmail interface: 这是我的Gmail界面外观的快照:
Here is what the raw headers look like: 这是原始标头的样子:
X-PHP-Originating-Script: 33:mailtest.php
Content-type: text/html;
Message-Id: <20130316153738.AA739118073@server.com>
Date: Sat, 16 Mar 2013 15:37:38 +0000 (UTC)
From: registration@site.com
From: Registration <registration@site.com>
Reply-To: registration@site.com
Return-Path: registration@site.com
<html>
The first From:
seems to be within the actual headers. 第一个
From:
似乎在实际的标题内。 The second From:
, and everything after that down to to <html>
is in the body. 第二个
From:
:,然后到<html>
都在正文中。
How do I get these header fields out of the email body and into the header where they belong? 如何从电子邮件正文中获取这些标题字段并放入它们所属的标题中?
http://php.net/manual/en/function.mail.php http://php.net/manual/zh/function.mail.php
additional_headers (optional)
[...]
Note:
If messages are not received, try using a LF (\n) only. Some Unix
mail transfer agents (most notably qmail) replace LF by CRLF
automatically (which leads to doubling CR if CRLF is used). This
should be a last resort, as it does not comply with RFC 2822.
删除第一个标头(text / html)中的分号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.