procmail
[Top] [All Lists]

Extracting headers from body of bounces

1998-01-27 10:36:45


Hi,  I'm trying to manage bounces from a mail-list (not from proper
mailing-list s/w unfortunately).  What I want to do is pull the original To:
address from the quoted body of the message thats been bounced back
by the remote Mail-Daemon and save it to a file of bounced addresses..
Below is what I've concocted, but procmail just keeps grabbing the *real*
To: header.  I thought the 'b' flag told it to work on the body, not the
header..

Any help is _much_ appreciated.  Any recommendations for better methods,
if any,  of handling mass bounces is welcomed too.  :)

Cheers,  Tony.


:0
* ^FROM_MAILER
* ^FROM_DAEMON
* !^Subject:.*(Fax|fax)
*
^Subject:.*(nresolvable|ndeliverable|fail|nrouteable|delivered|error|eturned|n
v
alid|Delivery)
{

:0 hwc:
$MAILDIR/IN.bounced.headers.$DATE

:0 b
BADADDER=`formail -zxTo:`
| cat $BADADDER >>$MAILDIR/IN.BadAddress.$DATE

}

Also, for some reason I can't fathom my end output is a file called
BADADDER=<infolive(_at_)infolive(_dot_)ie>   and with nothing in it...  
Aaaarggh  !!


One of my test mails is below, for reference, if it helps:

To: <infolive(_at_)infolive(_dot_)ie>
From: The Post Office <postmaster(_at_)infolive(_dot_)ie>
Sender: mailer-daemon(_at_)infolive(_dot_)ie
Subject: Delivery problems with your mail
Cc: The Post Office <postoffice(_at_)infolive(_dot_)ie>
Date: Sun, 21 Dec 1997 15:28:57 +0000

A copy of your message is being returned to you due to difficulties
encountered while attempting to deliver your mail.
To: <infolive(_at_)infolive(_dot_)ie>
From: The Post Office <postmaster(_at_)infolive(_dot_)ie>
Sender: mailer-daemon(_at_)infolive(_dot_)ie
Subject: Delivery problems with your mail
Cc: The Post Office <postoffice(_at_)infolive(_dot_)ie>
Date: Sun, 21 Dec 1997 15:28:57 +0000

A copy of your message is being returned to you due to difficulties
encountered while attempting to deliver your mail.

The following errors occurred during message delivery processing:


<smtp clubi.ie grahamw(_at_)clubi(_dot_)ie 29999>: RCPT 
To:<grahamw(_at_)clubi(_dot_)ie> | 550
<graham
w(_at_)clubi(_dot_)ie>... User unknown

----------  Original Message  ----------
external
origin ssn
rcvdfrom infolive.ie ([192.168.0.3])
with ESMTP
from <infolive(_at_)infolive(_dot_)ie>
to <grahamp(_at_)clubi(_dot_)ie>
Received: (from nobody(_at_)localhost) by infolive.ie (8.7.3/8.7.3) id QAA02788;
Sun,
 21 Dec 1997 16:08:34 GMT
Date: Sun, 21 Dec 1997 16:08:34 GMT
From: InfoLive <infolive(_at_)infolive(_dot_)ie>
Message-Id: <199712211608(_dot_)QAA02788(_at_)infolive(_dot_)ie>
To: grahamp(_at_)clubi(_dot_)ie                        <<----- This is what I 
want to
extract))
Subject: InfoLive password for graham whelan

Your InfoLive password is - xxxxx <<----- Sorry, changed :)

__________________________________________________
Tony Moran                      IT Manager
Ph:   (+353-1)-8303455          Scope Communications.
Fax: (+353-1)-8300888           http://www.infolive.ie
                                                        http://www.jobfinder.ie
      Ireland's online Jobs and IT resources Web Site - Check us out !
__________________________________________________
How to complain about Spam: http://weber.ucsd.edu/~pagre/spam.html


<Prev in Thread] Current Thread [Next in Thread>
  • Extracting headers from body of bounces, Tony Moran <=