A hound with more than one master

One way of doing Pine-style 'roles' in mutt

For quite a while I aspired to switch email client, from pine to mutt, but there were a few things that I couldn't find out how to do in the latter, one of which was pine's handy 'roles' feature, which lets you hit '#' and select an alter-ego from which to send a message.

For instance, I mostly send mail in a personal capacity, appearing to be from me at my vanity domain, but when I'm communicating on London Cycling Campaign in Hackney or Shoreditch Carnival business, I'll probably want my message to appear to be from me at the appropriate domain.

I couldn't find a ready-made function to achieve this in mutt, and consulted my happy hacker friend and former LinuxUser colleague Martin Howse of Artificial Paradises for a solution. He suggested that I try writing a macro to do it, so I did.

Here are the lines I've put into my .muttrc to do the job:

macro compose <esc>tp "<esc>f\Ca\CkTrevor Parsons \<trevor@MYDOMAIN\>\n"
macro compose <esc>hc "<esc>f\Ca\CkTrevor Parsons \<trevor@HACKNEYCYCLISTSDOMAIN\>\n"
macro compose <esc>sc "<esc>f\Ca\CkTrevor Parsons \<trevor@SHOREDITCHCARNIVALDOMAIN\>\n"

(Cunning attempt to deny the address harvester its crop there).

Thus, when I'm in the 'compose' mode of mutt (the mode where you see the headers of the email you're composing together with a listing of the attachments, including the message body), I just hit the escape key and then 'hc' for hackney-cyclists or 'tp' for my personal domain address. Easy when you know how.

This works for me with mutt version 1.5.4i, but I can't guarantee it will work for all versions. I hope this may prove useful to others looking to solve this problem.

PS You can automate what appears in the 'From:' header using hooks (see the Mutt manual). I've now started using send hooks to change which of my guises a particular message appears to be from depending on the recipient, but the above macro method is still a useful shortcut for switching between predefined roles at will.

Trevor Parsons, 18th October 2003.

Revised 15th November 2003: corrected 'hc' and 'tp' being the wrong way round in the quoted .muttrc lines.
Revised 16th February 2004 to include my real name in the 'from' roles.
Small revisions 3rd October 2004.