This is an in-progress guide for setting up Emacs (Doom Emacs) to send email from your personal Google (Gmail) user account.

As of [2024-02-12 Mon], the best I can figure is:

  • Configure smtpmail

    (setq
     smtpmail-smtp-server "smtp.gmail.com"
     smtpmail-smtp-service 587
     smtpmail-smtp-user "your-email@gmail.com")
    
  • Set up xoauth2 as an auth-source (a)

    I think it’d be nice to integrate emacs-oauth2-auto (a) to handle pulling new refresh tokens and release the whole thing as a gmail-focused package, similar to org-gcal.el (a).

    (setq
     send-mail-function 'smtpmail-send-it
     auth-source-xoauth2-creds ""
     auth-source-xoauth2-use-curl t)
    (auth-source-xoauth2-enable)
    (add-to-list 'smtpmail-auth-supported 'xoauth2)