procmail
[Top] [All Lists]

Re: Extracting Email Address In From: Field

1997-05-29 21:50:00
Sorry about posting the old message from sent-mail to the list. For some
reason, the post I made to the list yesterday never did show up, nor the
one Stan Ryckman made in response. I did get Stan's cc to me. I didn't
keep a copy of the post I made yesterday and inadvertantly sent an older
one. 

On Mon, 26 May 1997, Stan Ryckman wrote:

If you really insist that you want the contents of the From: field
under all circumstances, you run into a bit of trouble because parsing
that is not trivial under all circumstances. But if you're content
with an approximative method, try running the following on the output
of formail -zxFrom: 
 sed -e 's/ *([^)]*) *//g' -e 's/.*<\([^>]*\)>.*/\1/g'

        FROM=`formail -zxFrom: | \
        sed -e 's/ *([^)]*) *//g' -e 's/.*<\([^>]*\)>.*/\1/g'`

I've been using the sed recipe that Era posted with good success for 
several days now.


Cute.  But if you're willing to assume that email addresses have an "@"
in them and are well-behaved, wouldn't this work to set $MATCH with
no external process?:

  * ^From:.*[  <]\/[^  <]*(_at_)[^  >]*

(There should be a space and tab in each of the []'s, but this stupid
mailer won't put them in; I'm not on the shell machine at the moment.)

        FROM=* ^From:.*[        <]\/[^  <]+(_at_)[^      >]+

Should it be expressed like this? I haven't had any luck yet getting it 
to match. Stan mentioned using awk and I am curious about how the 
expression would be written and have no idea where to start.


        :0fw
        * ? test -s "$MEMBER_FILE"
        * ? fgrep -is "$WHOM" "$MEMBER_FILE"
        | ( formail -zk \
        -XDate: \
        -XFrom: \
        -XSubject: \
        ; cat -s $SIG_FILE )

How can I add fields like 'X-Loop:' after extracting them with '-X'. '-I' 
won't do it and echo and cat insert the fields after the body.

Regards,

Dave/Webmaster

    Sick And Tired Of SPAM? | Enjoy Great Humor?
         Join www.cauce.org | Join Joke-L
Hit SPAMMERS Where It Hurts | Listserv <listserv(_at_)ddave(_dot_)com>

           "So many SPAMMERS; so few comets."