2012-10-20 75 views
0

我在一個小的電子郵件列表管理器上使用this php class,我使用hotmail電子郵件和smtp.live.com發送電子郵件。它工作正常,但我收到了一些反彈的電子郵件,所以我想在另一個地址接收它們,這對我來說更容易管理它們。我嘗試過使用Return-Path頭,但hotmail似乎忽略它,並仍然將反彈發送到「from」地址。我還注意到,班級發送「NOTIFY = NEVER ORCPT = rfc822」爲「禁用」dsn,但hotmail似乎也忽略了它。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:<[email protected]> 
C RCPT TO:<[email protected]> NOTIFY=NEVER ORCPT=rfc822;email-that-bounces 
C DATA 
S 250 2.1.0 [email protected] OK 
S 250 2.1.5 [email protected] 
S 354 Start mail input; end with <CRLF>.<CRLF> 
C From: [email protected] 
To: [email protected] 
Return-Path: <[email protected]> 
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 <[email protected]> Queued mail for delivery 
C QUIT 
S 221 2.0.0 BLU0-SMTP333.blu0.hotmail.com Service closing transmission channel 
Disconnected. 

這是我如何發送電子郵件:如果我登錄到Hotmail和檢查「已發送」

$smtp->SendMessage(
    $from, array($to), 

    array(
     "From: $from", 
     "To: $to", 
     "Return-Path: <[email protected]>", 
     'Content-Type: multipart/alternative; boundary="'.$boundary.'"', 
     "Subject: $subject", 
     "Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z"), 
     "MIME-Version: 1.0" 
), "$body"); 

文件夾中,發送的電子郵件不包含返回路徑標題。

是不是有什麼毛病我送或Hotmail只是不支持返回路徑

回答

1

的返回路徑其實不是電子郵件的一部分的標題,它是SMTP信封的一部分。這意味着您不能將其添加爲任何其他郵件標題。

Return-Path來自SMTP事務。更具體地講,這是在返回路徑設置:

MAIL FROM:<[email protected]> 
+0

我試着設置一封不同於郵件發件人的電子郵件地址,而且我仍然收到在smtp上進行身份驗證的郵件的反彈。 –

+0

您是否嘗試過使用另一個發送SMTP服務器而不是Hotmail?很可能他們總是將登錄用戶設置爲返回路徑(實際上是一個明智的策略)。 –

0

我看,你是不是使用\r\n在你的代碼行的末尾。你應該嘗試添加並重新檢查。由於缺少這些字符,報告了很多報告和奇怪的行爲

Hotmail確實支持返回路徑,有幾次我忘記了該標題,並且測試郵件以垃圾文件夾結尾,只要我添加它,郵件直接進入收件箱

+0

我正在使用\ r \ n,我只是傳遞一個數組,而smtp類使用$ header_data。= $ headers [$ header]添加\ n \ r。「\ r \ n」; –