QQ邮箱使用SMTPLIB 报错550,'The “From” header is missing or invalid.原因以及解决办法
问题描述
最近在项目里遇到的邮箱邮件发送失败错误代码为550的问题,具体报错为:
(550, b’The “From” header is missing or invalid. Please follow RFC5322, RFC2047, RFC822 standard protocol. 帮助系统 ')
问题探索
报错函数体如下:
def send_email(self):
try:
email = MIMEText(self.message, self.send_email_type, "utf-8")
email["From"] = Header(self.header_from, "utf-8")