Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reading gmail is failing with IMAP

I am running a cron job which executes the python script for reading gmail (2 min interval). I have used imaplib for reading the new mails. This was working fine until yesterday. Suddenly its throwing below error

imaplib.error: [AUTHENTICATIONFAILED] Invalid credentials (Failure)

and sometimes i am getting the below error

raise self.abort(bye[-1]) imaplib.abort: [UNAVAILABLE] Temporary System Error

When i run the same script on a different machine. Its working fine. I am assuming that the host has been blacklisted or something like that.

What are my options ?

I cant generate the Credentials (Gmail API) as this is under company domain account.

like image 609
Mourya Ch Avatar asked Oct 14 '15 07:10

Mourya Ch


People also ask

Can't connect to Google IMAP server?

Enable IMAP Access in Gmail Settings Log into your Gmail account and click on a small gear in the right top corner of the window. Select See all settings. After that, go to the Forwarding and POP/IMAP tab. You need to make sure the IMAP Status is set to Enabled.


2 Answers

try with:

1) https://myaccount.google.com/lesssecureapps?pli=1

2) Gmail Settings -> Forwarding and POP / IMAP -> IMAP Acess to Enable IMAP

like image 152
Joakin Montesinos Avatar answered Sep 19 '22 01:09

Joakin Montesinos


Some apps and devices use less secure sign-in technology. So we need to enable Less secure app access option from gmail account.

Steps:

  1. Login into Gmail
  2. Go to Google Account
  3. Navigate to Security section
  4. Turn on access for Less secure app access

By following above steps, issue will be resolved.

like image 35
Sagar Bhavsar Avatar answered Sep 20 '22 01:09

Sagar Bhavsar