Smtplib. Smtpdataerror: (554, ' DT:SPM 126 SMTP5 Error Resolution

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.