Multiple sender identities (composing)
Stewart Smith
stewart at flamingspork.com
Mon May 16 02:29:07 PDT 2011
Thought I'd share this bit of my .emacs snippet that may be useful to go
on the emacs tips page.
This does the following:
- sets up a list of possible identities to have mail From
- on composing mail, it prompts you for who you want to send mail from
- pressing enter will give you the default (first in the list)
- otherwise you have tab completion
You may also want to set this:
'(message-sendmail-envelope-from (quote header))
(in custom-set-variables) so that if you're doing postfix sender based routing
or the like, it gets the correct address and doesn't end up sending
things the wrong way.
(setq stewart/mua-identities (list "Stewart Smith <stewart at flamingspork.com>" "Stewart Smith <stewart.smith at percona.com>"))
(defun stewart/notmuch-mua-mail (&optional from)
(interactive)
(setq from (completing-read "Sender identity: " stewart/mua-identities
nil t nil nil (car stewart/mua-identities)))
(notmuch-mua-mail nil nil (list (cons 'from from))))
(define-key notmuch-show-mode-map "m"
(lambda ()
"send email"
(interactive)
(stewart/notmuch-mua-mail)))
(define-key notmuch-search-mode-map "m"
(lambda ()
"send email"
(interactive)
(stewart/notmuch-mua-mail)))
--
Stewart Smith
More information about the notmuch
mailing list