0

I have the following in my init.el:

(require 'smtpmail)
(setq message-send-mail-function 'smtpmail-send-it
     smtpmail-stream-type 'starttls
     smtpmail-default-smtp-server "smtp.gmail.com"
     smtpmail-auth-credentials (expand-file-name "~/.authinfo.gpg")
     smtpmail-smtp-server "smtp.gmail.com"
     smtpmail-smtp-service 587)

.authinfo decrypts fine and contains:

machine smtp.gmail.com login ***1 password ***2 port 465

Where ***1 and ***2 are my username and password respectively.

But upon sending mail from mu4e I am still prompted for credentials.

If I enter the credentials at the prompt sending works.

What am I missing?

1

The auth-source lookup done by smtpmail uses the smtpmail-smtp-service port as well, so you need to specify '587' in .authinfo.gpg (although personally I advocate for using port 465 and a stream-type of 'tls).

  • Thank you very much. Why do you recommend tls/465 and will that work with the gmail servers? – mac Feb 10 at 12:16
  • Yes it works with gmail. The reason I recommend it is that when using direct tls, your connection is always encrypted. When using 587/starttls, the connection starts out unencrypted and is then 'upgraded' to encrypted, which leaves a window for your connection to be read, or even for the upgrading to be disabled (by filtering out the announcement of STARTTLS capability from the remote server). – rpluim Feb 10 at 12:23
  • Great feedback, thanks. – mac Feb 10 at 12:49
  • This thread suggests using port 25, which I understand is for establishing the session keys. Both ports 465 and 587 prompt me for my password. Do you not get prompted for a password when using ports 465 and 587? – mmorin Mar 12 at 11:44
  • There is no establishment of 'session keys' with SMTP. You connect to a port, using either TCP or TLS, and the remote server can then choose to prompt you for authentication. – rpluim Mar 12 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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