procmail
[Top] [All Lists]

Re: Extracting Email Address In From: Field

1997-05-25 23:31:00
On Sun, 25 May 1997 20:06:59 -0700 (PDT),
Dave/WebMaster <ddave(_at_)ddave(_dot_)com> wrote:
I have run into a brick wall (in my mind) trying to simplify this procmail
recipe. The line below, where formail is called, needs to strip everything
in the From: field except the actual email address in <>'s. I can't seem
to come up with a way to do this with formail and figure sed would have to
be called. Sed is a bit beyond my comprehension. Any ideas? 
     FROM=`formail -ztxFrom:`

You see this used a lot;

    FROM=`formail -rtzxTo:`

The reasoning is that the From: address isn't always the best place to
send a reply, a reply address usually being what you want, and when
it's not, it often doesn't matter as long as the result is unambiguous
and unique to one user (as in you example, apparently). Anyway,
formail figures it all out for you, and as a nice by-product, you get
a bare address with no comments. (Would be interesting to see what
formail does to some pathological examples but that doesn't belong
here.)

             * ? test -x "$SENDMAIL"

I haven't really looked at your recipe, but this caught my attention.
Is this a smart thing to do? I mean, if you didn't explicitly check
for the availability of Sendmail, you'd at least get an error message
in the log (in the unlikely event that other things are working AOK
while apparently some fairly central utilities are out to lunch :-)
but this one will just fail silently. 

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>