I'm trying to use mu4e to send/receive email with my Gmail account. I've followed what I believe is the official documentation here, but I think some of the description here seems outdated. As far as receiving mail goes, everything's fine - I'm using offlineimap and an app password from Google (which is saved in an encrypted file).

Sending mail is a problem - I write my message and hit ^C ^C, and am then prompted for an smtp username and password.

Here is the template that I'm using in my init.el:

(require 'smtpmail)
(setq message-send-mail-function 'smtpmail-send-it
   starttls-use-gnutls t
   smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
     '(("smtp.gmail.com" 587 "[email protected]" nil))
   smtpmail-default-smtp-server "smtp.gmail.com"
   smtpmail-smtp-server "smtp.gmail.com"
   smtpmail-smtp-service 587)

which is from the standard Gmail template with USERNAME appropriately changed.

I want to keep this setup relatively simple and I've seen other issues with more complicated arrangements that I want to avoid to begin with.

It does seem to me that I need a password of some kind -- how do I set this up (and why isn't this mentioned in this standard template?!). I played around with gnus before, is the simplest solution getting another app password and saving it to some auth.gpg file?

1 Answer 1


In the end, I created another app password from my google account and stored it in .authinfo.gpg, which is formatted as per the Gnus Gmail instructions

machine smtp.gmail.com login <USER> password <APP-PASSWORD> port 587

To get this to work, I added

   smtpmail-auth-credentials (expand-file-name "~/.authinfo.gpg") 

into the smtpmail config block shown in my initial question.

There may be something more convenient (I now have to separate app passwords for offlineimap and for smtpmail) but I'll figure that out as I go along.

  • This seems correct. I also have separate passwords for mbsync and smtpmail.
    – Ajned
    Commented Jul 1, 2021 at 18:28
  • Just wondering why separate gmail app passwords? I'm using the same for offlineimap as well as smtp
    – Kayo
    Commented Nov 7, 2022 at 6:13
  • @Kayo sorry, I switched to isync/mbsync shortly after and forgot why this was a problem Commented Nov 9, 2022 at 18:05
  • @nonreligious thanks for your reply
    – Kayo
    Commented Nov 12, 2022 at 2:36
  • Does anyone knows knows how to create an app-password without having to provide your phone number to google?
    – Ajned
    Commented Nov 13, 2022 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.