我正在尝试使用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, "liping.zhang@cimc.com", 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 "liping.zhang@cimc.com" isn\'t resolved. All recipients must be resolved before a message can be submitted. InvalidRecipientsException: Recipient "liping.zhang@cimc.com" isn\'t resolved. All recipients must be resolved before a message can be submitted. [Hostname=HK2PR01MB3123.apcprd01.prod.exchangelabs.com]')
这里发生了什么?我的代码有什么问题吗?
谢谢!