On Thu, 10 Apr 1997, Lars Kellogg-Stedman wrote:
moment I'm not using *any* recipes that generate autoreplies. To make
sure you're just getting the email address part of the message, sans
comments and other ornamentation, try this:
FROM=`formail -rtz -X "To:"`
That use of formail will prepend the string "To: "
Depending on the use one needs the senders bare address for this may
or may not be the contents of the "From:" If a "Reply-To:" field is
present, that will be what -rtxTo gets. Next it opts for the "From:".
If you use -rxTo, without the -t flag, it will get the "Reply-To:" if
present, and will next opt for the postmark '>From ' first, then if it
can't find one, it will get the 'From ', after that it gets "From:".
The safest way to snag an address to reply to is 'formail -zrtxTo' or
'formail -zrtXTo' if you want it to prepend the string "To: ".
(The -z flag is useful to strip leading or trailing whitespace.)
If you need the bare address in the "From:" field, then the one I
posted earlier is what will get it.
VAR=`formail -zx"From:" | cut -d'<' -f2 | cut -d'>' -f1`
It's messy, but it works. ;-)
David