I'm using notmuch message mode in emacs and I'm trying to send a message using msmtp. When I try to send a mail from within emacs it suddenly opens my default system email client, Evolution, and creates the new mail in that, complete with the text that I'd just entered into emacs-notmuch. I want it to just send the mail from within emacs.

I know this isn't a problem with msmtp because I can send emails via msmtp from the command line. And when I check my msmtp logs, the attempts to send from emacs aren't there. It isn't getting that far.

I wonder if this is a permissions issue of some kind, because in /usr/bin, msmtp shows up with a GID bit set. I am new to GID settings but it seems to be the only file that has it.

Can anyone point me in the right direction?

Here is the relevant bit of my emacs config:

(setq send-mail-function 'sendmail-send-it
     sendmail-program "/usr/bin/msmtp"
     mail-specify-envelope-from t
     mail-envelope-from 'header
     message-sendmail-envelope-from 'header)

1 Answer 1


Emacs wasn't talking to msmtp because of an incorrect sendmail definition. Change the correct variable definition on the first line to:

(setq message-send-mail-function 'message-send-mail-with-sendmail 
  • If you accept your own answer StackExchange will stop hassling us about it :-)
    – rpluim
    Dec 1, 2021 at 16:20
  • Oh whoops! Sorry, have done that now.
    – RubyNoob
    Dec 2, 2021 at 4:42

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.