On Thu, Apr 02, 2020 at 12:01:38PM +1100, raf wrote:
Jens John wrote:

On Wed, 1 Apr 2020, at 06:22, raf wrote:
e.g. Add a CC header to f...@work.com whenever sending/replying/forwarding from m...@work.com unless the email is already going to f...@work.com.

I think a combination of hooks or only a send2-hook could be used.

How about something along these lines (not tested):

send2-hook "~f m...@work.com !(~C f...@work.com)" "my_hdr cc: f...@work.com"

thanks. that looks really promising but i can't get it to have any effect. i tried reply-hook and send-hook as well but it never triggers. i have other (simple) send-hooks that work fine.

Mutt's send-hook and reply-hook are useful for making configuration and from-header changes based on recipients. They aren't designed for the reverse, because they trigger after recipients have been determined.

The link you posted (albeit at the wrong website) ;-), <http://www.mutt.org/doc/manual/#compose-flow>, is a good place to look for the details.

In bullet 2, my_hdr is processed to add to the initial Cc recipients. Bullet 3 then prompts using those recipients. All the hook processing occurs afterwards, so a hook adding Cc my_hdr won't affect the *current* composition session.

Unfortunately, that means you have to get creative to do what you want to do. The perl script you wrote sounds like a good idea. Another idea might be to set the my_hdr in advance via a folder hook, or via a macro that also changes the $from setting.

--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA

Attachment: signature.asc
Description: PGP signature

Reply via email to