Sending gmail with oauth2

227 views
Skip to first unread message

Schaumburg Samuel

unread,
Aug 24, 2016, 2:36:54 AM8/24/16
to mu-discuss
Hey there,

I wonder if there is a way to make mu4e work with google oauth2.

I have used a setup as described in the manual, using smtpmail-send-it
for sending mail. I fetch mail with offlineimap, which I made to work
with google oauth2.

Here's the code concerning sendmail:
(setq message-send-mail-function 'smtpmail-send-it
     smtpmail-stream-type 'starttls
     smtpmail-default-smtp-server "smtp.gmail.com"
     smtpmail-smtp-server "smtp.gmail.com"
     smtpmail-smtp-service 587)

However, this is not working, because google is not accepting the
credentials this way.

Does anybody know, if it is possible to set up smtpmail to also work
with oauth2 ?

Since I am not that good with lisp, I would be happy if anybody had a
code snippet I could use to make that work.


Magnus Therning

unread,
Aug 24, 2016, 5:11:37 AM8/24/16
to mu-di...@googlegroups.com
I have the following function for sending email via gmail, and it works:

(setq message-send-mail-function 'smtpmail-send-it
starttls-use-gnutls t
smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
smtpmail-default-smtp-server "smtp.gmail.com"
smtpmail-smtp-server "smtp.gmail.com"
smtpmail-smtp-service 587
smtpmail-debug-info t)

With credentials in ~/.authinfo.

I think I might have found out how to do it at https://www.emacswiki.org/emacs/SendingMail

/M

--
Magnus Therning OpenPGP: 0x927912051716CE39
email: mag...@therning.org jabber: mag...@therning.org
twitter: magthe http://therning.org/magnus

Finagle's Fifth Law:
Always draw your curves, then plot your readings.
signature.asc

Schaumburg Samuel

unread,
Aug 29, 2016, 2:19:33 AM8/29/16
to mu-discuss
This is not working.
First of all credentials in .authinfo are not loaded and have to be typed in manually.
When trying to connect this is the error message returned, saying that google is refusing to connect.
As I said, I need smtpmail to not use plain authentication, but oauth2.
smtpmail-send-it: Sending failed: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbux
534-5.7.14 NhQlKaQMILdGaKzCZyHqyUXnisBcD16OV07yK7-1zViydtt-qhkWrHGLfyAzAcJRg21-0X
534-5.7.14 Q0gzJ3yIs8Pm3Mz6FvBCg128aqu8X6tn6mHCN6C3fu_1e8SV8JxLn0osLtbXa2GMVdjei_
534-5.7.14 GgRrQWlX02f45ujVZT0dale0LlKAe7DlEnCBbYRC_c7SBnpNBfzshb99F0gq4gJq6WVPRG
534-5.7.14 s7-eQpdbOoPi4GEJCrdajmMO3Wsuc> Please log in via your web browser and
534-5.7.14 then try again.
534-5.7.14  Learn more at
534 5.7.14  https://support.google.com/mail/answer/78754 3sm11794000wms.1 - gsmtp in response to AUTH PLAIN AHNhbXVlbC5zY2hhdW1idXJnQGdvb2dsZW1haWwuY29tAHV0ZDk5OXJxX3Jhc2Fqb2dpamE=


Reply all
Reply to author
Forward
0 new messages