Q:

Sending email fails with `Process smtpmail not running`

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:
(setq
 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?

A:

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 587 password XYZ

You can use port 587 (TLS, secure), or port 25 (no TLS, non-secure). If you use 587, you need to also set the auth-source lookup to that value:
(setq smtpmail-smtp-service 587)

For password protection look at .netrc , or GPG.
Update from OP: in a previous version, I used port 25 (SMTP without TLS) in ~/.authinfo, else I was prompted with SMTP user name for smtp.office365.com (default email):. Thanks to @rpluim for the setting of smtpmail-smtp-service in a comment to @Cenderme's answer.

