send-hook and aliases

[email protected]
Newsgroups gmane.mail.mutt.user
Message-ID <[email protected]>
On Fri, Feb 14, 2025 at 01:23:17AM -0500, Jon LaBadie wrote:

> alias   partbox =part
> send-hook       '[email protected]'    my_hdr Fcc: partbox

> "partbox" does not get replaced with "=part".

> While I do not need an alias for Fcc:, I do for Bcc:.
> My alias looks like:

> alias dbpart \
>         "Andy Griffin" <[email protected]>, \
>             <100+ more lines like above>
>         "Vivian Leigh" <[email protected]>

> The corresponding send-hook that DOES NOT work would be:

> send-hook       '[email protected]'    my_hdr Bcc: dbpart

> The Bcc: line in my vi compose session is blank (i.e. only
> the "Bcc: " is present).

> NOTE, if I manually edit the Bcc: line and add the alias "dbpart",
> the alias is substituted upon exiting vi and the 100+ addresses are
> present in the "ask send" screen of mutt.  It is this manual edit
> requirement that I often forget and would like to replace with an
> automated technique.

I see, it looks like mutt doesn't expand aliases when processing
my_hdr commands. It makes sense actually -- my_hdr can be any header
at all, not necessarily relating to addresses.

I don't have a pure mutt answer. I use emacs for editor, and if it
were me, I would just write some elisp to execute automatically when
opening a file that can be identified as a mutt message being
composed. In fact I already have some elisp code like that, even
though it doesn't modify the message, for now.

Another possibility, depending on your sendmail / smtp setup and how
much control you have over it: you could do the alias processing in
the MTA, i.e. have an entry in /etc/aliases, or make a fake user and
put the expansion in the ~/.forward file of that user.

-- 
Ian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.