procmail
[Top] [All Lists]

Re: Catching an e-mail address from text of message

1997-05-08 07:24:00
On Thu, 8 May 1997 08:16:42 -0400 (EDT),
Brock Rozen <brozen(_at_)webdreams(_dot_)com> wrote:
The mail you sent could not be delivered to:
550 stefg9(_at_)aol(_dot_)com is not a known user
I'd like to catch the e-mail address listed after the 550 and none of the
text after it.

For aol only, apparently? If you want to make it more general, it
becomes hairy, because there seems to be as many variations of bounce
messages as there are bounces. :-/

I'm trying to use this, but it catches the text after the address also.
:0
* ^From: Mailer-daemon(_at_)aol(_dot_)com
* 550 \/[^ ]* .*
| /usr/users/brozen/bin/pg/pgrem -q $MATCH

What's the " .*" for? The \/ will put into MATCH everything after it
that matches; if you want to get rid of it, you can force a new match,
or avoid matching all that in the first place. 

But the following should suffice if you want only something fairly
close to the given example (i.e. only AOL bounces):

    * ^ *550 \/[^ ]+

By "force a new match", I mean something like

    * ^ *550 \/[^ ]* .*
    {
        * MATCH ?? ^^[^ ]+
    }

i.e. when you get a match, you can do another match on MATCH with the
?? operator and see to it that that only picks up the part of the
match that you want. In this case, though, I see no need for this kind
of trickery. 

There's an explanation of some of the MATCH magic by Phil Guenther at

    http://www.iki.fi/~era/procmail/matching.html

(start browsing from the bottom of the page if you only want the
punchline ;-)

/* 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>

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