Currently I have several distinct mailing addresses, with different purposes. My personal mailing address (dpn@isomerica.net), my UNH educational address (login@cisunix.unh.edu or just login@unh.edu), and my UNH physics address (login@physics.unh.edu). Obviously, replace login with my real login to get the real email address. All of these mails forward to dpn@isomerica.net, and I view them all together.
What I wanted was a setup where mutt would automagically set the From: line and the .signature file used when I replied to mail sent to addresses other than dpn@isomerica.net. The prevents several potential issues: I don’t want to mix my personal and work mails unless I have to, and I don’t like to confuse people by having my reply come from a different address than the one they sent to. This is actually very easy to do. Simply add these lines to .muttrc:
# This makes mutt set the From: line to the original's To: line when replying
set reverse_name
# This sets a default reply-hook
reply-hook . "set signature="~/.signature""
# This changes the signature file when replying to messages sent to physics.unh.edu
reply-hook "~t physics.unh.edu" "set signature="~/.signature_physics"
The only remaining issue is the fact that it remains difficult to choose a From: line and a signature for emails which begin a thread (IE, emails that aren’t replies). However, it isn’t that difficult to manually change the signature in vim while composing the email and alter the From: before sending the message. If there is an easier way to automate this as well, please do let me know.
UPDATE: I left out the default reply-hook before. Since this posting has climbed to the top of google, I wanted to make sure it was corrected.