1. In the automated test, when the calling mail module automatically sends the mail, the running foot of this report is wrong:
Smtplib. Smtpdataerror: (554, ' DT:SPM 126 smtp5,jtkowad3mjz2c1jxlck2aa--. 52114s2 1465021431,please See http://mail.163.com/ help/help_spam_16.htm?ip=123.114.121.110&hostid=smtp5&time=1465021431 ')
2. Workaround (Here is Python for example):
#定义发送邮件
def send_mail (file_new):
f = open (File_new, ' RB ')
Mail_body = F.read ()
F.close ()
msg = Mimetext (mail_body, ' html ', ' Utf-8 ')
msg = Mimetext (' Please view the contents of the attachment! ', ' plain ', ' utf-8 ')
msg[' Subject ' = Header ("Automated test Report", ' Utf-8 ')
#报错原因是因为 "sender and recipient parameters are not defined
Msg[' from '] = ' [email protected] '
Msg[' to '] = ' [email protected] '
SMTP = Smtplib. SMTP ()
Smtp.connect ("smtp.126.com")
Smtp.login ("[Email protected]", "Login password")
Smtp.sendmail ("[email protected]", "[email protected]", msg.as_string ())
Smtp.quit ()
Print (' Mail sent successfully email has send out! ')
3. Use this method (green Code section) to resolve the 554 of the relevant mailbox, ' DT:SPM error.
Smtplib. Smtpdataerror: (554, ' DT:SPM 126 SMTP5 Error Resolution