mnot
mnot

Reputation: 161

Using Gmail Through Python Authentication Error

*EDIT: SOLVED IT (answer below)

I'm getting an authentication error 534 from gmail when I try to run the following code:

    server = smtplib.SMTP('smtp.gmail.com', 587)
    server.starttls()
    server.login("[email protected]", "password")
    msg = "Hello from the other side!"
    server.sendmail("[email protected]", "[email protected]", msg)
    server.quit()
    return 'Message Sent'

I also noticed that google picked up the login attempt and flagged it as a suspicious device because I'm runnning the code from a server on AWS in another state... however, I flagged it as my device, and I'm still getting the same error. What should I do?

*I also DID turn on access for less secure apps to login.

Upvotes: 0

Views: 572

Answers (1)

mnot
mnot

Reputation: 161

After telling google that it WAS my device, I just had to do this before the changes could propagate!

https://accounts.google.com/DisplayUnlockCaptcha

Problem = Solved

Upvotes: 1

Related Questions