I have tried solve this for many many hours ;(

macOS 11.1, Emacs 27.1 (brew), Gnus 5.13, msmtp 1.8.14 (brew)

I use GNUS to read maildir that is synced using mbsync. I can read mail using GNUS but sending gives me

Warning: Opening nnimap server on office365...failed: ; Unable to open server nnimap+office365 due to: office365/imaps nodename nor servname provided, or not known
Sending via mail...
Opening nnimap server on office365...
Server nnimap+office365 previously determined to be down; not retrying
Opening nnimap server on office365...failed:
gnus-inews-do-gcc: Can\u2019t open server archive

The mail is sent but GNUS think it is not. I can send email from the command line without any error or warning, so this should not be a msmtp configuration problem

cat msmtp-test.txt | msmtp -a default my.mail@gmail.com

The msmtp exe pointed out by the sendmail-program is verified to be used. I tried just about everything, the simple

(setq sendmail-program "/usr/local/bin/msmtp")
(setq send-mail-function 'message-send-mail-with-sendmail)
(setq smtpmail-debug-info t smtpmail-debug-verb t)

and many other settings I found on various pages.

Any hints what is going on or how to debug this is appreciated,


  • Note that IMAP has nothing to do with sending, only retrieving/reading. SMTP is for sending. Hence, the fact that you have errors accessing the IMAP server does not mean that emails are not sent. The problem is that you are asking for a copy to be stored on the IMAP server which is obviously failing for some reason. – éric Jan 25 at 15:21

It looks like

  1. successful email sending itself
  2. failed saving of sent message copy in IMAP Sent folder [nnimap server on office365]
  • Thanks! Still no idea how to debug it. I added (setq message-sendmail-extra-arguments '("--debug")) but the verbose output in *Messages* says nothing about an error. – kboortz Jan 23 at 13:04
  • @kboortz Try to connect to nnimap+office365 and report error messages. You may report nnimap+office365 configuration - it seems to be faulty. – AnFi Jan 23 at 13:12
  • Thanks, but what do you mean by "connect"? The mail is sent, just that GNUS thinks it is not. There is no mention of "imap" in my .emacs or .gnus, I have set to use "msmtp" for sending emails and verified that it is used. – kboortz Jan 23 at 13:20

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.