I followed this guide to set up IMAP email with Emacs, mu, and mu4e. I can pull email and view it in mu4e alright, but I can't seem to send email. I press C for Compose, edit the email, then C-c C-c to send, and I get Process smtpmail not running in the mini-buffer window.

My SMTP configuration in ~/.emacs is:

 message-send-mail-function   'smtpmail-send-it
 user-mail-address "name@domain.tld"
 smtpmail-default-smtp-server "smtp.office365.com"
 smtpmail-smtp-server         "smtp.office365.com"
 smtp-mail-service 587
 smtpmail-local-domain        "name@domain.tld")

I haven't found any pointers to this problem. Am I missing something obvious?

  • perhaps : message-send-mail-function 'smtpmail-send-it ? – manandearth Nov 27 '18 at 17:24
  • Isn't that the second line of my code? – mmorin Nov 27 '18 at 19:04
  • it is... you are right . what about a smtpmail-stream-type value 'starttls or other? – manandearth Nov 27 '18 at 20:18
  • That does work, yes! It prompts me for username and password and I get Sending failed: ... Authentication unsuccessful [domain.domain.PROD.OUTLOOK.COM] in response to [random characters]. I tried setting (setq smtpmail-auth-credentials '(("smtp.office365.com" 25 "username@domain.com" "password"))) as in this EmacsWiki and it still prompts me for the password. It does the same with 587 instead of 25. How can I set the credentials? – mmorin Nov 30 '18 at 11:52
  • That should be in your .offlineimaprc file. – manandearth Nov 30 '18 at 12:30

Check the IMAP settings of the email provider. Office365, for example, has these settings under Settings > Your app settings > Mail > Mail > Accounts > POP and IMAP:

SMTP setting

Server name: smtp.office365.com

Port: 587

Encryption method: STARTTLS

Therefore, adding this line in your ~/.emacs should work:

(setq smtpmail-stream-type 'starttls)

You need to specify your credentials for SMTP in addition to those for IMAP (which would be in ~/.offlineimaprc, for example). You can give your credentials in the mini-buffer during the first authentication, or you can save this text in ~/.authinfo:

machine smtp.office365.com login username@domain.com port 25 password XYZ

Notice the use of port 25 (SMTP without TLS) for authentication, and the use of port 587 (SMTP with TLS) for sending mail after authentication.

For password protection look at .netrc , or GPG

  • That's not the way SMTP AUTH works: you authenticate and send using the same port, in this case 587. (Direct TLS to port 465 would be even better, but maybe Office365 doesn't support that). – rpluim Dec 17 '18 at 8:41

Add these into your init file:

smtpmail-stream-type 'starttls
smtpmail-starttls-credentials '(("smtp.office365.com" 587 nil nil))
smtpmail-auth-credentials '(expand-file-name "~/.authinfo.gpg")

I use spacemacs, so you might want to change these lines. Change your .authinfo file like this

machine smtp.office365.com login email@hotmail.com port 587 password "pass"
machine outlook.office365.com login "email" port 993 password "pass"

Also, type this into terminal

gpg2 -c .authinfo
This protects your files with GPG. It will ask for a password, just enter anything.

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.