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