try:
smtpObj = smtplib.SMTP(mail_host, 587)
#smtpObj.connect(mail_host, port=587)
smtpObj.starttls()
smtpObj.set_debuglevel(1)
#smtpObj.ehlo()
smtpObj.login(mail_user, mail_pass)
smtpObj.sendmail(sender, receivers, message.as_string())
print("邮件发送成功")
smtpObj.quit()
except smtplib.SMTPException as e:
print(e)
发送邮件会报错,麻烦大神指点一下:
(554, b"5.2.0 STOREDRV.Submission.Exception:InvalidRecipientsException; Failed to process message due to a permanent exception with message Recipient ‘’ is not resolved. All recipients must be resolved before a message can be submitted. InvalidRecipientsException: Recipient ‘’ is not resolved. All recipients must be resolved before a message can be submitted. [Hostname=SH0PR01MB0892.CHNPR01.prod.partner.outlook.cn]")