Section 38th: Python failed to send mail via SMTP protocol, error 505 or 535 or 554__python

Source: Internet
Author: User
Tags server port
Send failed error 1:SMTPLIB. Smtpauthenticationerror: (A, B ' User has no permission ')
When we use Python to send a message, the custom client logs on with the user name and password, and then uses the SMTP service to send the mail, and the newly registered 163 mailboxes are not enabled by default, so logins are always denied. Workaround (Take 163 mailboxes for example): Enter 163 mailbox-set-Client authorization password-open (authorization code is used to log in to Third-party mail client's private password), non-third party login password unchanged.


Error 2:SMTPLIB. Smtpauthenticationerror: (535, B ' error:authentication failed ')

Take 163 mailboxes as an example, in the open POP3/SMTP service, and open the client authorization password will set the authorization code, this authorization code instead of Smtplib. The password in the SMTP (). Login (User,password) method.


Here's the code that Python sends mail using the SMTP protocol:

[Python] view plain copy #coding:utf-8   import smtplib   from  email.mime.text import mimetext  #  introduced Smtplib and mimetext      host  =  ' smtp.163.com '   #  setting up the outgoing server address    port = 25  #  Set the outgoing server port number. Note that there are SSL and non-SSL two forms    sender =  ' XXXXXX@163.com '   #  set up the email address, be sure to register your own mailbox     pwd =  ' XXXXXX '   #  set the password of the email, etc will be used in    receiver =  ' XXXXXXXX@YY.com '  #  set mail recipient, can be a button mailbox    body =  ' error 3:SMTPLIB. Smtpdataerror: (554, ' DT:SPM 163 smtp9,) The reason: The code is missing the sender and receiver, as follows: Some common mailbox sender servers and port numbers

Mailbox Sender Server non-SSL protocol port SSL Protocol port

163 smtp.163.com 25 465/587

QQ smtp.qq.com 25 465/587

Related Article

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.