我在小型电子邮件列表管理器上使用this php class,我正在使用hotmail电子邮件和smtp.live.com发送电子邮件。它工作正常,但我收到了一些反弹的电子邮件,所以我想在不同的地址接收它们,以便我更容易管理它们。我已经尝试使用Return-Path标头,但Hotmail似乎忽略它并仍然将弹跳发送到“发件人”地址。我还注意到该类发送“NOTIFY = NEVER ORCPT = rfc822”来“禁用”dsn,但hotmail似乎也忽略了它。
php类打印的SMTP事务看起来像这样:
Resolving SMTP server domain "smtp.live.com"...
Connecting to host address "65.55.96.11" port 587...
Connected to SMTP server "smtp.live.com".
S 220 BLU0-SMTP333.blu0.hotmail.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.4675 ready at Sat, 20 Oct 2012 06:51:46 -0700
C EHLO 192.168.1.1
S 250-BLU0-SMTP333.blu0.hotmail.com Hello [1.2.3.4]
S 250-TURN
S 250-SIZE 44242340
S 250-ETRN
S 250-PIPELINING
S 250-DSN
S 250-ENHANCEDSTATUSCODES
S 250-8bitmime
S 250-BINARYMIME
S 250-CHUNKING
S 250-VRFY
S 250-TLS
S 250-STARTTLS
S 250 OK
C STARTTLS
S 220 2.0.0 SMTP server ready
Starting TLS cryptograpic protocol
TLS started
C EHLO 192.168.1.1
S 250-BLU0-SMTP366.blu0.hotmail.com Hello [1.2.3.4]
S 250-TURN
S 250-SIZE 44242340
S 250-ETRN
S 250-PIPELINING
S 250-DSN
S 250-ENHANCEDSTATUSCODES
S 250-8bitmime
S 250-BINARYMIME
S 250-CHUNKING
S 250-VRFY
S 250-AUTH LOGIN PLAIN
S 250 OK
C AUTH LOGIN
S 334 DXdlcm3hfW36
C ZW1haWwxQGhvdG1haWwuY29t
S 334 UDCzd5dvdmQe
C MTIzNDU2
S 235 2.7.0 Authentication succeeded
C MAIL FROM:<email19@hotmail.com>
C RCPT TO:<email-that-bounces@hotmail.com> NOTIFY=NEVER ORCPT=rfc822;email-that-bounces
C DATA
S 250 2.1.0 email1@hotmail.com....Sender OK
S 250 2.1.5 email-that-bounces@hotmail.com
S 354 Start mail input; end with <CRLF>.<CRLF>
C From: email1@hotmail.com
To: email-that-bounces@hotmail.com
Return-Path: <otheremail@myserver.com>
Content-Type: multipart/alternative; boundary="fd9c131c7e7f727fd34567b8a131218a52114gha"
Subject: subject
Date: Sat, 20 Oct 2012 15:51:45 CEST
MIME-Version: 1.0
C --fd9c131c7e7f727fd34567b8a131218a52114gha
Content-Type: text/plain; charset="ISO-8859-1
Content-Transfer-Encoding: 7bit
email message
--fd9c131c7e7f727fd34567b8a131218a52114gha
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit
email message
--aa9c111c7e7f727bf74367b8a131918a36314dba--
C
.
S 250 2.6.0 <BLU0-SMTP43555fdccc0ecf4@BLU0-SMTP333.blu0.hotmail.com> Queued mail for delivery
C QUIT
S 221 2.0.0 BLU0-SMTP333.blu0.hotmail.com Service closing transmission channel
Disconnected.
这是我发送电子邮件的方式:
$smtp->SendMessage(
$from, array( $to ),
array(
"From: $from",
"To: $to",
"Return-Path: <otheremail@myserver.com>",
'Content-Type: multipart/alternative; boundary="'.$boundary.'"',
"Subject: $subject",
"Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z"),
"MIME-Version: 1.0"
), "$body");
如果我登录hotmail并查看“已发送”文件夹,则发送的电子邮件不包含返回路径标题。
我发送的标头是否有问题,或者hotmail不支持返回路径
答案 0 :(得分:1)
Return-Path实际上不是电子邮件的一部分,它是SMTP信封的一部分。这意味着您无法将其添加为任何其他邮件标题。
返回路径是从SMTP事务派生的。更具体地说,这是设置Return-Path的地方:
MAIL FROM:<email19@hotmail.com>
答案 1 :(得分:0)
我发现您没有在代码中使用\r\n
作为行尾。你应该尝试添加它并重新检查。由于缺少这些字符,报告了大量报告和奇怪的行为
Hotmail确实支持返回路径,有几次我忘记了标题,测试邮件最终在垃圾文件夹中,一旦我添加它,消息直接进入收件箱