After executing the code below, it displays a message "smtplib.SMTPAuthenticationError: (535, b'5.7.8 Error: authentication failed: UGFzc3dvcmQ6')" login and password are correct, email created especially for testing. What could be the reasons for failed login?
import smtplib
mailFrom = "Test email sends"
mailTo = ["python123321testowy@op.pl"]
mailSubjest = "Test message"
mailBody = '''
email
test
test
'''
msg = '''From: {}
Subject: {}
{}
'''.format(mailFrom,mailSubjest,mailBody)
user = "python123321testowy@op.pl"
password = "pwd"
server = smtplib.SMTP_SSL('SMTP.poczta.onet.pl', 465)
server.ehlo()
server.login(user, password)
server.sendmail(user, mailTo, msg)
server.close()
I have tried changing ports, email service providers and host. After launching the program, a test email is to be sent.
server.set_debuglevel(1) output:
send: 'ehlo [192.168.0.19]\r\n'
reply: b'250-smtp.poczta.onet.pl\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-SIZE 90000000\r\n'
reply: b'250-ETRN\r\n'
reply: b'250-AUTH PLAIN LOGIN XOAUTH2\r\n'
reply: b'250-AUTH=PLAIN LOGIN XOAUTH2\r\n'
reply: b'250-ENHANCEDSTATUSCODES\r\n'
reply: b'250 8BITMIME\r\n'
reply: retcode (250); Msg: b'smtp.poczta.onet.pl\nPIPELINING\nSIZE 90000000\nETRN\nAUTH PLAIN LOGIN XOAUTH2\nAUTH=PLAIN LOGIN XOAUTH2\nENHANCEDSTATUSCODES\n8BITMIME'
send: 'AUTH PLAIN AHB5dGhvbjEyMzMyMXRlc3Rvd3lAb3AucGwAUXdlcnR5MTIzNDU2Nzg5QEAh\r\n'
reply: b'535 5.7.8 Error: authentication failed: \r\n'
reply: retcode (535); Msg: b'5.7.8 Error: authentication failed:'
send: 'AUTH LOGIN cHl0aG9uMTIzMzIxdGVzdG93eUBvcC5wbA==\r\n'
reply: b'334 UGFzc3dvcmQ6\r\n'
reply: retcode (334); Msg: b'UGFzc3dvcmQ6'
send: 'UXdlcnR5MTIzNDU2Nzg5QEAh\r\n'
reply: b'535 5.7.8 Error: authentication failed: UGFzc3dvcmQ6\r\n'
reply: retcode (535); Msg: b'5.7.8 Error: authentication failed: UGFzc3dvcmQ6'
send: 'quit\r\n'
reply: b'221 2.0.0 Bye\r\n'
reply: retcode (221); Msg: b'2.0.0 Bye'