使用python smtplib通过Office365发送电子邮件时,无法解析普通电子邮件地址

问题描述

我正在尝试使用python发送电子邮件,这基本上是我的代码

mail_host = MAIL_HOST
mail_user = MAIL_USER
mail_pass = MAIL_PASS
mail_postfix = MAIL_POSTFIX
self.server = smtplib.SMTP(mail_host,port=MAIL_PORT)
self.server.ehlo()
self.server.starttls()
self.server.login(mail_user + "@" + mail_postfix,mail_pass)
self.my_name = MAIL_disPLAY_SENDER
self.my_addr = self.my_name+"<"+mail_user+"@"+mail_postfix+">"
self.server.sendmail(self.my_addr,"[email protected]",message.as_string())

然后我收到此错误

smtplib.SMTPDataError: (554,b'5.2.0 STOREDRV.Submission.Exception:InvalidRecipientsException; Failed to process message due to a permanent exception with message Recipient "[email protected]" isn\'t resolved. All recipients must be resolved before a message can be submitted. InvalidRecipientsException: Recipient "[email protected]" isn\'t resolved. All recipients must be resolved before a message can be submitted. [Hostname=HK2PR01MB3123.apcprd01.prod.exchangelabs.com]')

这里发生了什么?我的代码有什么问题吗?

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)