undefinedfix
Sign in

Why does verification fail when using Python smtplib to send e-mail?

user617883 edited in Fri, 14 Oct 2022
Using Python smtplib to write a small program to automatically send test report, but after writing, the program will report an error, and the prompt is as follows:
535'5.7.8 Error: authentication failed: authentication failure'

I printed the specific interaction process as follows:

send: 'EHLO server\r\n'
reply: '250-Forcepoint email protection service\r\n'
reply: '250-SIZE 34529280\r\n'
reply: '250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN\r\n'
reply: '250-ENHANCEDSTATUSCODES\r\n'
reply: '250 8BITMIME\r\n'
reply: retcode (250); Msg: Forcepoint email protection service
SIZE 34529280
AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN
ENHANCEDSTATUSCODES
8BITMIME
(250, 'Forcepoint email protection service\nSIZE 34529280\nAUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN\nENHANCEDSTATUSCODES\n8BITMIME')
send: 'ehlo localhost.localdomain\r\n'
reply: '250-Forcepoint email protection service\r\n'
reply: '250-SIZE 34529280\r\n'
reply: '250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN\r\n'
reply: '250-ENHANCEDSTATUSCODES\r\n'
reply: '250 8BITMIME\r\n'
reply: retcode (250); Msg: Forcepoint email protection service
SIZE 34529280
AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN
ENHANCEDSTATUSCODES
8BITMIME
send: 'AUTH CRAM-MD5\r\n'
reply: '334 PDE2I5ODk2MzguMTEzNTcxMDlAc210cGludGVybmFsLmxlbm92by5jb20+\r\n'
reply: retcode (334); Msg: PDE2I5ODk2MzguMTEzNTcxMDlAc210cGludGVybmFsLmxlbm92by5jb20+
send: 'bnZmc2VydmljZavcZW5vdm8uY29tIDIzYjFjYmU4N2I4OWUxOTZmODRiZjk1NDFhMTU5NjFh\r\n'
reply: '535 5.7.8 Error: authentication failed: authentication failure\r\n'
reply: retcode (535); Msg: 5.7.8 Error: authentication failed: authentication failure
(535, '5.7.8 Error: authentication failed: authentication failure')

I checked on the Internet and said that this kind of error is mostly due to the input of the email password rather than the authorization code. At the same time, I also asked the administrator, who said that there is no authorization code in the company's email, and I can also guarantee that the user name and password I entered are correct. Please give me some advice

2 Replies
ecisse
commented on Fri, 14 Oct 2022

SMTP and IMAP are not necessarily enabled by default. You need to set the authorization code when enabling authorization

mohaa8844
commented on Sat, 15 Oct 2022

The picture below is a screenshot of my 163 mailbox, which I have used for testing. Whether it's your own mailbox server or a third party, there should be authorization. The user name and password are used to log in to the web page or the client, but the third party can't guarantee the security, so you must be authorized to log in with the authorization code, which is equivalent to not giving you the root account information.

clipboard.png

clipboard.png

lock This question has been locked and the reply function has been disabled.