procmail
[Top] [All Lists]

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

1997-05-08 12:03:00
At 04:20 PM 5/8/97 +0300, era eriksson wrote:
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

Did I miss something?  Doesn't this look for 550 in the header only?

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 \/[^ ]+

Can I play too?  :-)  We can be a bit more general I think.  I think I've
sometimes seen addresses like "<bouncer(_at_)domain(_dot_)com>" in bounce
messages.  (Yours will do for AOL though, unless they change.)
I'd suggest finding it anywhere in the line (WARNING: untested):

    # find "word" containing @ after 550; if enclosed in "<>", strip them
    * ^ *550 (.* )*<?\/[^ ]+(_at_)[^ >]+

(and of course the *body* needs to be fed to this).

Cheers,
Stan

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