conditional automatic cc header?
raf
mutt at raf.org
Thu Apr 2 01:01:38 UTC 2020
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.
i see a lot of documentation online that says
send-hooks match on recipients which might be a reason
but man muttrc itself doesn't say that. any pattern
that only uses header data should work. and anyway,
even tests using ~t didn't work. i must be doing
something very dumb.
but if i could get it to work, send2-hook looks good. i
didn't know about that. according to:
https://neomutt.org/guide/advancedusage.html#compose-flow
send2-hook happens after editing but it also says that
send2-hook is evaluated each time the headers are
changed (assuming mutt and neomutt are similar in that
regard), so the Cc header might not be there in the
editor session but it should at least be added after
editing. but i didn't observe that behaviour either.
but if it worked, it would handle the case where i have
to manually edit the from address in the editor.
> I do not know if my_hdr would respect headers that are already
> there. For example, if you set a header using the editor CCing a few
> people, Fred should only be added.
i thought that my_hdr might replace any existing header
(for From: it does) but i tested my_hdr Cc: (without
the send2-hook) and, if there is already a Cc header,
it adds the header content to what is already there. it
doesn't replace it or even add a new Cc header. clever
little mutt.
cheers,
raf
More information about the Mutt-users
mailing list