Always CC specific messages to some people (send-hook and my_hdr)
Gregory Heytings
ghe at sdf.org
Fri Nov 13 00:49:03 UTC 2020
>
> When emailing to someone with mutt, I would like to have my messages
> automatically CC'd to someone. Typically, we are a team of academics
> working with a student, and I would like my exchanges with the student
> to be sent to others.
>
> Mutt aliases seems to be on a "per field" basis. So I could use it to
> put my coworkers in an alias, but they would be in the "To:" field, not
> "CC".
>
> I wanted to use a send-hook and the my_hdr variable, but it works for
> other fields (such as adding a "Organization: A Really Big Company,
> Anytown, USA", from the manual). But not for the CC field (the manual
> says: "note that my_hdr commands which modify recipient headers, or the
> message's subject, don't have any effect on the current message when
> executed from a send-hook").
>
> Is there a workaround? Perhaps with the recent muttlisp?
>
> Setting edit_headers to yes for all my messages(and having a nice macro
> in my editor) would not help, since I'd like such a behavior for only a
> fraction of my communication.
>
I would do this as follows:
# rebinds "r"
macro index,pager r '<enter-command>set my_wait_key=$wait_key; set nowait_key;<return><pipe-message>autocc.sh<return><enter-command>source ~/.mutt/autocc.out<return><enter-command>set wait_key=$my_wait_key<return><reply>' "smart reply"
and the autocc.sh script:
#!/bin/sh
echo unmy_hdr Cc > ~/.mutt/autocc.out
MAIL=$(mktemp)
cat - > $MAIL
# check (with grep or another tool of your choice) if the sender appears in the email headers, and if so:
echo my_hdr Cc: ... >> ~/.mutt/autocc.out
rm -f $MAIL
More information about the Mutt-users
mailing list