python3使用smtplib发邮件被退回

在尝试使用Python3的smtplib模块通过公司邮件服务器发送邮件时遇到问题,由于服务器不支持SSL,邮件被退回。错误信息提示'BAD HEADER'。经过研究发现,需要设置邮件的'date'字段,但在官方文档中未明确提及这一参数。通过添加msg['date']解决了问题。
摘要由CSDN通过智能技术生成

背景:公司自己的邮件服务器,不支持ssl

退回信息:

This is the mail system at host mail.*****.net.cn.

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 postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                  The mail system

<zhaimingyu@*****.net.cn>: host 127.0.0.1[127.0.0.1] said: 554 5.6.0 Reject,
   id=19530-16 - BAD HEADER (in reply to end of DATA command)
Reporting-MTA: dns; mail.*****.net.cn
X-Postfix-Queue-ID: 899B32129B
X-Postfix-Sender: rfc822; zhaimingyu@*****.net.cn
Arrival-Date: Thu, 12 Jul 2018 16:31:42 +0800 (CST)

Final-Recipient: rfc822; zhaimingyu@*****.net.cn
Original-Recipient: rfc822;zhaimingyu@*****.net.cn
Action: failed
Status: 5.6.0
Remote-MTA: dns; 127.0.0.1
Diagnostic-Code
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值