我不使用Python,但我想Gmail改进了对DSN的支持,因为我的测试成功了:
您可以在下面的示例中看到,这是一条包含“Content Type:multipart/report;report Type=delivery status”的多部分消息。
我确定它是DSN的可靠方式是:第一行是“返回路径:<;>;”
内容类型为“multipart/report”,其中“report Type=delivery status”
那么,我知道:报告内容位于content Type为“消息/传递状态”的部分
状态和操作字段始终显示在报表内容中。
注意,状态字段的精度可能低于诊断代码字段中最终出现的其他状态(不是必需的)。但是,下面的示例很好(所有字段中的状态相同)
原始消息位于Content Type=“message/rfc822”部分。有时,MTA只返回没有内容的原始邮件头。在本例中,内容类型是“text/rfc822 headers”。
发送电子邮件至test-DSN-failure@gmail.com后收到的示例DSN:Return-path: <>
Received: from xxx ([xxx])
by xxx with ESMTP; Fri, 04 May 2012 16:18:13 +0200
From: (Mail Delivery System)
To: xxx
Subject: Undelivered Mail Returned to Sender
Date: Fri, 04 May 2012 15:25:09 +0200
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="HTB3nt3RR7vw/QMPR4kDPbKg+XWjXIKdC/rfHQ=="
This is a MIME-encapsulated message.
--HTB3nt3RR7vw/QMPR4kDPbKg+XWjXIKdC/rfHQ==
Content-Description: Notification
Content-Type: text/plain
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
: 550-5.1.1 The email account that you tried to reach does not exist. Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1 http://support.google.com/mail/bin/answer.py?answer=6596 t12si10077186weq.36
--HTB3nt3RR7vw/QMPR4kDPbKg+XWjXIKdC/rfHQ==
Content-Description: Delivery report
Content-Type: message/delivery-status
Reporting-MTA: dns; xxx
Arrival-Date: Fri, 04 May 2012 15:25:09 +0200
Final-Recipient: rfc822; test-dsn-failure@gmail.com
Status: 5.1.1
Action: failed
Last-Attempt-Date: Fri, 04 May 2012 15:25:09 +0200
Diagnostic-Code: smtp; 550-5.1.1 The email account that you tried to reach does not exist. Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1 http://support.google.com/mail/bin/answer.py?answer=6596 t12si10077186weq.36
--HTB3nt3RR7vw/QMPR4kDPbKg+XWjXIKdC/rfHQ==
Content-Description: Undelivered Message
Content-Type: message/rfc822
[original message...]