Home > Enterprise >  What does this error message mean in Python?
What does this error message mean in Python?

Time:11-07

I made an email spam bot a while ago for fun. (Just as a test and to mess with friends) I tried to run it today and it wouldn't work. Any ideas why and how to fix? I've made sure that this API has access to my email.

Edit: Error Message is Traceback (most recent call last): File "C:\Users\user\OneDrive\Desktop\Code\Spam Bot.py", line 10, in server.login('email', 'password') File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 750, in login raise last_exception File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 739, in login (code, resp) = self.auth( File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 662, in auth raise SMTPAuthenticationError(code, resp) smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials r185-20020acadac2000000b0035173c2fddasm754089oig.51 - gsmtp')


e = 0

server = smtplib.SMTP('smtp.gmail.com', 587)

server.starttls()

server.login('email', 'password')
while(e < 2):
    server.sendmail('email',
                'receiver',
                'text'
                )
    e = e   1
    print("DONE")```

CodePudding user response:

Username and Password not accepted.

Do to the removal of less secure apps you can not use the gmail users actual password when connecting to the smtp server.

You must either enable 2fa on the account and configure an apps password, or switch to using Xoauth2.

  • Related