我使用 python sendmail 以及 NOTIFY、RET、ENVID 选项从我的邮件服务器发送邮件。当我按照上述程序向 outlook 邮件 ID 发送邮件时,我收到了 dsn。但是当我向 gmail 或 yahoo 发送邮件时,我没有收到 dsn。
发送到 Outlook 时的 SMTP 日志
send: 'ehlo ip-172-31-89-244.ec2.internal\r\n'
reply: '250-VE1EUR03FT018.mail.protection.outlook.com Hello [101.102.103.104]\r\n'
reply: '250-SIZE 49283072\r\n'
reply: '250-PIPELINING\r\n'
reply: '250-DSN\r\n'
reply: '250-ENHANCEDSTATUSCODES\r\n'
reply: '250-STARTTLS\r\n'
reply: '250-8BITMIME\r\n'
reply: '250-BINARYMIME\r\n'
reply: '250-CHUNKING\r\n'
reply: '250 SMTPUTF8\r\n'
reply: retcode (250); Msg: VE1EUR03FT018.mail.protection.outlook.com Hello [101.102.103.104]
SIZE 49283072
PIPELINING
DSN
ENHANCEDSTATUSCODES
STARTTLS
8BITMIME
BINARYMIME
CHUNKING
SMTPUTF8
send: 'mail FROM:<[email protected]> size=1392 RET=HDRS ENVID=76\r\n'
reply: '250 2.1.0 Sender OK\r\n'
reply: retcode (250); Msg: 2.1.0 Sender OK
send: u'rcpt TO:<[email protected]> NOTIFY=SUCCESS,FAILURE,DELAY\r\n'
reply: '250 2.1.5 Recipient OK\r\n'
reply: retcode (250); Msg: 2.1.5 Recipient OK
send: 'data\r\n'
reply: '354 Start mail input; end with <CRLF>.<CRLF>\r\n'
reply: retcode (354); Msg: Start mail input; end with <CRLF>.<CRLF>
data: (354, 'Start mail input; end with <CRLF>.<CRLF>')
send: 'Content-Type: multipart/alternative;\r\n boundary="===============4828387674099477551=="\r\nMIME-Version: 1.0\r\nDate: Thu, 17 Jan 2019 12:21:49 +0530\r\nFrom: [email protected]\r\nMessage-Id: <CAEFoQ7qve5kck0xaMnQwi-QNiTJqVSCN1qVDu_9F1kCy0kUpGA@mail.gmail.com>\r\nOriginal-Envelope-Id: 76\r\nResent-Date: Thu, 17 Jan 2019 12:21:49 +0530\r\nResent-From: srikanth vr1 <[email protected]>\r\nResent-Message-Id: <CAEFoQ7qve5kck0xaMnQwi-QNiTJqVSCN1qVDu_9F1kCy0kUpGA@mail.gmail.com>\r\nSubject: REGISTERED: test\r\nTo: [email protected]\r\nDKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; \r\n d=example.com; [email protected]; \r\n q=dns/txt; s=dkim; t=1547707909; h=content-type : \r\n mime-version : date : from : message-id : resent-date : \r\n resent-from : resent-message-id : subject : to : date : \r\n from : subject; \r\n bh=4u6uddMjage5G2IhNFHSL+jOjAVzjaLpUnrgPqdbTdU=; \r\n b=q0n8iNOyPgkVYKuuGDcIRsobyr6ySnjIvApWqr30i6u/zLQGBu9KMEwZ\r\n deOyZlfWIo7tYoGUJYy5McqqevpwfCqVTeE1ButctqE9k6d+ggQZf6Zjqq\r\n PL2Rt4TJNmUY3hrpWvMYi353FnZ0N44tBLeRFDzJT1UV2/LIQRD/kwbmE=\r\n\r\n--===============4828387674099477551==\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset="us-ascii"\r\nContent-Transfer-Encoding: 7bit\r\n\r\ntest\r\n\r\n--===============4828387674099477551==\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset="us-ascii"\r\nContent-Transfer-Encoding: 7bit\r\n\r\n<div dir="ltr">test</div>\r\n\r\n--===============4828387674099477551==--\r\n.\r\n'
reply: '250 2.6.0 <CAEFoQ7qve5kck0xaMnQwi-QNiTJqVSCN1qVDu_9F1kCy0kUpGA@mail.gmail.com> [InternalId=36941013765396, Hostname=VE1EUR03HT108.eop-EUR03.prod.protection.outlook.com] 8366 bytes in 0.875, 9.337 KB/sec Queued mail for delivery -> 250 2.1.5\r\n'
reply: retcode (250); Msg: 2.6.0 <CAEFoQ7qve5kck0xaMnQwi-QNiTJqVSCN1qVDu_9F1kCy0kUpGA@mail.gmail.com> [InternalId=36941013765396, Hostname=VE1EUR03HT108.eop-EUR03.prod.protection.outlook.com] 8366 bytes in 0.875, 9.337 KB/sec Queued mail for delivery -> 250 2.1.5
data: (250, '2.6.0 <CAEFoQ7qve5kck0xaMnQwi-QNiTJqVSCN1qVDu_9F1kCy0kUpGA@mail.gmail.com> [InternalId=36941013765396, Hostname=VE1EUR03HT108.eop-EUR03.prod.protection.outlook.com] 8366 bytes in 0.875, 9.337 KB/sec Queued mail for delivery -> 250 2.1.5')
send: 'quit\r\n'
reply: '221 2.0.0 Service closing transmission channel\r\n'
reply: retcode (221); Msg: 2.0.0 Service closing transmission channel
发送到 Gmail 时的 SMTP 日志
send: 'ehlo ip-172-31-89-244.ec2.internal\r\n'
reply: '250-mx.google.com at your service, [101.102.103.104]\r\n'
reply: '250-SIZE 157286400\r\n'
reply: '250-8BITMIME\r\n'
reply: '250-STARTTLS\r\n'
reply: '250-ENHANCEDSTATUSCODES\r\n'
reply: '250-PIPELINING\r\n'
reply: '250-CHUNKING\r\n'
reply: '250 SMTPUTF8\r\n'
reply: retcode (250); Msg: mx.google.com at your service, [101.102.103.104]
SIZE 157286400
8BITMIME
STARTTLS
ENHANCEDSTATUSCODES
PIPELINING
CHUNKING
SMTPUTF8
send: 'mail FROM:<[email protected]> size=1394 RET=HDRS ENVID=77\r\n'
reply: '250 2.1.0 OK p19-v6si3114094ejj.94 - gsmtp\r\n'
reply: retcode (250); Msg: 2.1.0 OK p19-v6si3114094ejj.94 - gsmtp
send: u'rcpt TO:<[email protected]> NOTIFY=SUCCESS,FAILURE,DELAY\r\n'
reply: '250 2.1.5 OK p19-v6si3114094ejj.94 - gsmtp\r\n'
reply: retcode (250); Msg: 2.1.5 OK p19-v6si3114094ejj.94 - gsmtp
send: 'data\r\n'
reply: '354 Go ahead p19-v6si3114094ejj.94 - gsmtp\r\n'
reply: retcode (354); Msg: Go ahead p19-v6si3114094ejj.94 - gsmtp
data: (354, 'Go ahead p19-v6si3114094ejj.94 - gsmtp')
send: 'Content-Type: multipart/alternative;\r\n boundary="===============2153953495280056619=="\r\nMIME-Version: 1.0\r\nDate: Thu, 17 Jan 2019 12:28:54 +0530\r\nFrom: [email protected]\r\nMessage-Id: <CAEFoQ7p5QHdEEjDHLaMh-GnSjcwqFKG7ASdFqaVoUZz6-3DVcw@mail.gmail.com>\r\nOriginal-Envelope-Id: 77\r\nResent-Date: Thu, 17 Jan 2019 12:28:54 +0530\r\nResent-From: srikanth vr1 <[email protected]>\r\nResent-Message-Id: <CAEFoQ7p5QHdEEjDHLaMh-GnSjcwqFKG7ASdFqaVoUZz6-3DVcw@mail.gmail.com>\r\nSubject: REGISTERED: test\r\nTo: [email protected]\r\nDKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; \r\n d=example.com; [email protected]; \r\n q=dns/txt; s=dkim; t=1547708334; h=content-type : \r\n mime-version : date : from : message-id : resent-date : \r\n resent-from : resent-message-id : subject : to : date : \r\n from : subject; \r\n bh=4r/lVPfZ7dZjsNwHEGhBbR/HBl5Nd6TIhMAgBJYGzsI=; \r\n b=hNRVKYa7d2DK7MD6nEPKEZrG3oR7ZTZkCLly9FfQWC+kHJzA91q72nXG\r\n eVxupk1VBcATvceewzW06VUXhKBMdciKPfqzJoATm90oQEYxiDLEp8dWeM\r\n TjWKPM7//yNimuoyMzFdnFumk6tIlf+MOiDZ8CZi28p3ulUcDOV2qm0EM=\r\n\r\n--===============2153953495280056619==\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset="us-ascii"\r\nContent-Transfer-Encoding: 7bit\r\n\r\ntest\r\n\r\n--===============2153953495280056619==\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset="us-ascii"\r\nContent-Transfer-Encoding: 7bit\r\n\r\n<div dir="ltr">test</div>\r\n\r\n--===============2153953495280056619==--\r\n.\r\n'
reply: '250 2.0.0 OK 1547708335 p19-v6si3114094ejj.94 - gsmtp\r\n'
reply: retcode (250); Msg: 2.0.0 OK 1547708335 p19-v6si3114094ejj.94 - gsmtp
data: (250, '2.0.0 OK 1547708335 p19-v6si3114094ejj.94 - gsmtp')
send: 'quit\r\n'
reply: '221 2.0.0 closing connection p19-v6si3114094ejj.94 - gsmtp\r\n'
reply: retcode (221); Msg: 2.0.0 closing connection p19-v6si3114094ejj.94 - gsmtp
您可以在 gmail 日志 DSN 中看到没有出现在正在使用的选项列表中。yahoo 也发生了同样的事情。
提前致谢
答案1
您不会收到 Google 发送的递送状态通知,因为 Google 不会发送此类通知。事实上,他们的 SMTP 服务器并未宣传支持 DSN,因此您不应期望收到此类通知。