nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] (n)mh tip of the day

2015-10-20 14:30:30
ken wrote:
I just came up with this, and I thought it might be useful to people.

I put in my components file the following line:

%<{from}%?(getenv MH_FROM)%|%(void(localmbox))%>%(void(width))%(putaddr 
From: )

That lets me, in priority order, set my From: header as the following:

- The -from switch to comp(1)
- The value of the MH_FROM environment variable
- Nmh's idea of my local mailbox (configured via Local-Mailbox, or if
  that's missing taking a guess based on the local username and hostname).

I have a few shell aliases which set MH_FROM to useful values.  I find
myself juggling multiple identities more and more, and I finally got tired
of editing my From: header by hand.  That's not the only piece of the
puzzle, though ... I have a postproc which submits the email to the
'correct' SMTP server and my replcomps has a number of contortions to
choose the correct From: header (that works actually surprisingly well
in practice).

As a question to everyone else: how do others who juggle multiple email
identities make it work?

other than occasionally manually editing the From: line in the draft,
my outgoing identity is chosen based on the folder that's current when
i send or reply to mail.

my Editor profile component is a script which does a bunch
of arcane editing of the draft file before i ever see it.  the same
script runs whether composing, forwarding, or replying.  it pre-dates
replcomps, so some of what it does has to do with sucking in and
quoting body parts when replying or forwarding.  it also inserts an
attribution line (the "ken wrote:", above), and, to your question, it
sets my From: line, and sometimes sets my Fcc: and Reply-to: lines.
it also appends a folder-appropriate .sig line, if there isn't one
present already.  after it finally invokes vi, and i've edited the
mail, it does a couple of sanity checks.  one of those is checking the
From: and To: domains (with a simple grep), to see if i'm about to send
mail to my employer or coworkers from my personal address, which can
happen if i wasn't in the right folder when i started.

basically it's a shell script instantiation of "chewing gum and string".

paul
=----------------------
 paul fox, pgf(_at_)foxharp(_dot_)boston(_dot_)ma(_dot_)us (arlington, ma, 
where it's 58.1 degrees)

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>