1

I have username and password of gmail account, I need API to automatically login to gmail from my python code.

I have tried using smtplib

import smtplib
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.starttls() 
username="test@gmail.com"
password="test"
server.login(username, password)
server.quit()

I am getting smtplib.SMTPAuthenticationError error

ishita sharma
  • 401
  • 3
  • 15

1 Answers1

0

Go to Google account security settings and login to your account.

You need to scroll down and turn the options "Allow less secure apps" to on.

Saket Khandelwal
  • 347
  • 1
  • 11