Conditional signature in mutt

Mutt is a wonderful mail client, which I use daily and intensively. In my .muttrc I defined a signature containing my home address, which gets appended to every mail I send. However, when replying to mailing lists, I don’t want my home address to appear, as mailing lists are indexed by most search engines.

This extra line in .muttrc can solve the issue, using hooks:

send-hook . 'set signature="~/sys/signature.txt"'
send-hook '~t ^list@domain\.org$' 'unset signature'

This way, whenever I press L and the To: header contains the specific address or matches the regex pattern in the second hook, the signature is unset.

As settings changed by hooks are remembered by mutt for the rest of the session, the first hook is a necessary addition. Mutt will now set the last chosen signature every time, unless the reply is sent to a list. Without the first hook, mutt would not add signatures to personal emails after sending something to a list, as the setting unset signature would be kept as default.