conditional automatic cc header?

raf mutt at raf.org
Thu Apr 2 23:31:35 UTC 2020


Kevin J. McCarthy wrote:

> 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 fred at work.com whenever
> > > > sending/replying/forwarding from me at work.com unless the email is
> > > > already going to fred at 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 me at work.com !(~C fred at work.com)" "my_hdr cc: fred at 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

Hi Kevin,

Thanks for the explanation. It's much appreciated.
I think I'll stick with the perl script since it's
already working. And thanks for all your effort
on mutt. It truly does suck less.

cheers,
raf



More information about the Mutt-users mailing list