Saravana
Saravana

Reputation: 33

Python imaplib: Authentication failed for yahoo account irrespective of correct credentials

I'm using python's imaplib for fetching and manipulating mails. Everything works fine with gmail account. But, when I try to login to yahoo account using the same, authenctication failed with following error, irrespective of correct credentials provided:

File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/imaplib.py", line 593, in login
    raise self.error(dat[-1])
imaplib.error: b'[AUTHENTICATIONFAILED] LOGIN Invalid credentials'
yahooSmtpServer = "imap.mail.yahoo.com"
yahooSmtpPort = 993
client = imaplib.IMAP4_SSL(yahooSmtpServer, yahooSmtpPort)
client.login(username, password)

Upvotes: 1

Views: 1200

Answers (1)

arainchi
arainchi

Reputation: 1492

TLDR: Generate App Password by following instructions from this link

Long answer:

From Download your email from Yahoo Mail with IMAP

Your login info

If you're using Yahoo Account Key or some older email apps, generate an app password and use that for your account password.

  • Email address - Your full email address (name@domain.com)
  • Password - Your account's password
  • Requires authentication - Yes

Upvotes: 0

Related Questions