On Mon, 16 May 2011 19:29:07 +1000, Stewart Smith <stewart at flamingspork.com> 
> 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

And here's the same for choosing the identity when forwarding a mail:

;; Choose the identity used to forward a mail
(defun schnouki/notmuch-mua-forward-message ()
  (let* ((from (ido-completing-read "Sender identity: " schnouki/mua-identities
                                    nil nil nil nil (car 
         (address-components (mail-extract-address-components from))
         (user-full-name (car address-components))
         (user-mail-address (cadr address-components)))

(people who don't use or like ido may want to replace
ido-completing-read with completing-read)

If anyone is interested, I have some more useful snippets available on
- function to choose a signature according to the From header
- function to choose the sender identity according to the To header
  (useful for replying to work e-mails using your work address, or for
  replying to a ML with a subscribed address that won't be rejected)
- function to change the SMTP server that will be used for sending the
  mail according to the From header

It seriously lacks documentation so don't hesitate to ask if you have
any problem with it :)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available

Reply via email to