How to change $record in mutt depending on the from address

mutt

I use multiple accounts in mutt, and wish to save sent messages to different $record directories. I am aware of folder-hook; if I compose in different folders, I can change $record depending on the associated account of the initial folder.

However, sometimes, I might want to compose from a different folder, or forward an email to one account from another, or reply from a different account, or change my mind mid-composition (I have set edit_headers=yes). Hence, it makes more sense to save the sent email to a specific directory based on the from field. Is that possible?

I understand that fcc-hook could change $record based on recipients, but I'd like to change it based on sender instead.

Best Answer

You can use fcc-hook to change the folder depending on all sorts of parameters.

fcc-hook '~f foo@example.com' '=foo-folder'
fcc-hook '~f bar@example.com' '=bar-folder'

I also use it to depend on the subject (all messages whose subject contains "ISDN" go to my =ISDN folder, for example), use '~s' for that.

Related Question