mutt & {folder,send}-hooks

I want to set my From: in mutt depending on a) the recipient address, & b) the folder I'm in. I've had the first task working for a long time with send-hooks that set my_hdr From: ... but I had no success in combining those send-hooks with folder-hooks.

finally I found something somewhere on the web that didn't work out of the box but showed me the direction. here's what I'm doing now (abbreviated & with some extra space for legibility):

folder-hook .      "unhook send-hook"
folder-hook .      "send-hook .                      'my_hdr From: gregor herrmann <gregor.herrmann@comodo.priv.at>'"
folder-hook debian "send-hook .                      'my_hdr From: gregor herrmann <gregor+debian@comodo.priv.at>'"
folder-hook .      "send-hook '~t ^.+@.*debian\.org' 'my_hdr From: gregor herrmann <gregor+debian@comodo.priv.at>'"

short explanation:

  • line 1: clear the list of send-hooks
  • line 2: regardless of folder & recipient set my From:
  • line 3: when I'm in a folder whose name matches debian always set my From: accordingly.
  • line 4: regardless of folder set my From: differently when sending a mail to $something@$subdomain.debian.org

& it seems to work & I'm quite happy ;-)

gregoa, 2006-09-01 ff.

Creative Commons License
All material on this blog — unless stated otherwise — is © gregor herrmann, and is licensed under the Creative Commons Attribution-Share Alike 3.0 Austria License.