send-hook and aliases

googly.negotiator862 at aceecat.org googly.negotiator862 at aceecat.org
Fri Feb 14 17:52:12 UTC 2025


On Fri, Feb 14, 2025 at 01:23:17AM -0500, Jon LaBadie wrote:

> alias   partbox =part
> send-hook       'PDDBDBC at labadie.us'    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" <96griffin at gmail.com>, \
>             <100+ more lines like above>
>         "Vivian Leigh" <vl96 at yahoo.com>

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

> send-hook       'PDDBDBC at labadie.us'    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


More information about the Mutt-users mailing list