0

Actually, sending mails works fine. But the error is annoying because it causes mu4e to keep the compose buffer open. Normally, it would close the buffer and save the mail to the sent folder. So I have to do it manually every time.

The complete message I get is:

message-send-mail-with-sendmail: Sending...failed to mail for [ -oi --read-envelope-from -t ] : send was successful;

I am sure that msmtp is working perfectly since there are no errors in the log and sending the exact same mail from the terminal returns a 0 exit code.

The sendmail part of the emacs config is:

  (setq
        sendmail-program (executable-find "msmtpq")
        send-mail-function 'smtpmail-send-it
        message-sendmail-f-is-evil t
        message-sendmail-extra-arguments '("--read-envelope-from")
        message-send-mail-function 'message-send-mail-with-sendmail
        mml-secure-openpgp-sign-with-sender t
        message-kill-buffer-on-exit t
  )

Where does 'Sending...failed to' part of the message come from, and how can I debug it?

2
  • 1
    Look at the error message: it says that it was produced by message-send-mail-with-sendmail. If you do C-h f message-send-mail-with-sendmail, it says it's a function in message.el. The filename message.el is a link, so you can click on it to get to the Lisp code of the function. You can see that the function issues that error message. What I can't see is why the mail for [ -oi --read-envelope-from -t ] : send was successful; ended up in the error buffer, making the function think that something went awry.
    – NickD
    Commented Jul 13 at 16:53
  • All I can think of is that somebody is being verbose and writing out "helpful" messages and those are captured by call-process-region and added to the error buffer.
    – NickD
    Commented Jul 13 at 21:05

1 Answer 1

1

Thank you NickD! Apparently, message-send-mail-with-sendmail fills the error with whatever sendmail-program writes to stdout and doesn't care about the exit code.

msmtp does not write anything to stdout whereas msmtpq outputs mail for [ -oi --read-envelope-from -t ] : send was successful;.

So, changing sendmail-program (executable-find "msmtpq") to sendmail-program (executable-find "msmtp") solved the issue.

2
  • Actually the function checks the return code (if it gets a non-zero code, it produces a different message), but if message-interactive is non-nil, it also checks the buffer and issues the above message if the buffer is non-empty.
    – NickD
    Commented Jul 15 at 4:57
  • 1
    Thanks for pointing out! I guess this should be correct: the error buffer is filled with the output of sendmail-program, no matter what the exit code is. Commented Jul 18 at 22:48

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.