[Mutt] help on complicated per-folder or per-sender sending email hooks

Mihai Lazarescu mtlagm at gmail.com
Fri Nov 26 16:53:54 UTC 2021


On Thursday, November 25, 2021 at 18:32:50 -0600, maitra at email.com wrote:

> I had a few more questions. Is it possible to have a hook based on where the email is coming to? So, if I am in this folder, then I use the above, but I am wondering if I can have a hook that says something like if the e-mail was sent to maitra at email.com then use the same account.

reverse_name may help if you always want to reply using the 
address on which you received the message.

For more flexibility, you may want to unset reverse_name and look 
at reply-hook and/or send-hook and send2-hook instead, e.g.:

reply-hook  '.' 'set from = [your address when no match]
reply-hook  '~h @([-[:alnum:]_]+\.)*somedomain\.com' 'set from = ...'

and send-to counterparts:

send-hook   '! ~Q' 'set from = [your address when no match]
send-hook   '~t @([-[:alnum:]_]+\.)*somedomain\.com' 'set from = ...'
send2-hook  '~t @([-[:alnum:]_]+\.)*somedomain\.com' 'set from = ...'

> Also, how do I give multiple folders for a hook? So, in the above, if I am in mutt or R or fedora, etc, I can use that account? Or do I specify one hook for each folder?

This should do:

folder-hook '(mutt|R|fedora)' 'set ...'

> Many thanks again for your help, Mihail!

Glad I can help.

Mihai


More information about the Mutt-users mailing list