Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git imap-send with Gmail

Using this Git:

$ git --version
git version 2.5.1

With this configuration:

$ git config --list | grep imap
imap.folder=[Gmail]/Drafts
imap.host=imaps://imap.gmail.com

If I run this command:

cat 0001-alpha.patch | git imap-send

This is the result:

Resolving imap.gmail.com... ok
Connecting to [2607:f8b0:400e:c03::6d]:993... ok
Logging in...
Username for 'imaps://imap.gmail.com':
Password for 'imaps://[email protected]':
IMAP command 'LOGIN <user> <pass>' returned response (NO) - [ALERT] Please log in via your
  web browser: https://support.google.com/mail/accounts/answer/78754 (Failure)
*** IMAP ALERT *** Please log in via your web browser:
  https://support.google.com/mail/accounts/answer/78754 (Failure)
IMAP error: LOGIN failed
failed to open store

Strangely, it still asks for credentials and fails even if I am already logged in via my browser. How can I use git imap-send with Gmail?

like image 970
Zombo Avatar asked Oct 09 '15 01:10

Zombo


2 Answers

From what "gmail login failure using python and imaplib" describes, you cannot user user/password account to use gmail.com outside the web browser.

You would have to use XOAuth2 (that can be generated through various modules), whose scope is imap and smtp (or enabling access for less secure app).

Considering oauth isn't mentioned in git, lowering the security, as unsafe as it sound, might be the only possibility in this instance.

like image 171
VonC Avatar answered Oct 08 '22 21:10

VonC


To fix this, I had to turn on access for less secure apps.

Using curl to send email

like image 33
Zombo Avatar answered Oct 08 '22 19:10

Zombo