I'm using msmtp and this setup and some gnus-posting-styles
successfully on Emacs 24.1.1.
(defun cg-feed-msmtp () (if (message-mail-p) (save-excursion (let* ((from (save-restriction (message-narrow-to-headers) (message-fetch-field "from"))) (account (cond ;; I use email address as account label in ~/.msmtprc ((string-match "mitchelh@example1.com" from) "example1") ;; Add more string-match lines for your email accounts ((string-match "mitchelh@example2.com" from) "example2")))) (setq message-sendmail-extra-arguments (list '"-a" account)))))) (setq message-sendmail-envelope-from 'header) (add-hook 'message-send-mail-hook 'cg-feed-msmtp) (setq gnus-posting-styles '(("nnimap\\+EXAMPLE2:INBOX" (address "mitchelh@example2.com"))))