procmail
[Top] [All Lists]

Re: Detecting bounces

1998-12-08 06:50:29
| 19-00-00 era eriksson <era(_at_)iki(_dot_)fi> list.procmail
| On Mon, 7 Dec 1998 17:41:35 -0500, Matthew Harrell
| <mharrell(_at_)std(_dot_)saic(_dot_)com> wrote:
|  >         How can I detect bounce messages from all kinds of MTA's? I
|  > know how to detect bounces from sendmail and qmail, but all the
|  > systems I've encountered seem to do it somewhat differently.
| 
| That, as they say, is the problem.
| 
| If you are looking for a simple recipe which will catch all bounces,
| there is no such recipe. 
| 
| I can offer you some M$ Exchange bounces you can study if you want to
| figure out if there is any method to that madness. :-)


It's pity that not don't follow sendmail convention. I wrote a module to
trap the daemon messages, mostly bounces. If someone is interested it
can be found form pm-code.shar kit. (See File Server in X-info).

Pm-jadaemon.rc -- Handle DAEMON messages by changing subject

    Description
 
        When you send a message to a address that had delivery troubles,
        you get a DAEMON message back explaining the error problem. I
        usually want to save these daemon mesaages to a different folder
        and check the folder from time to time. A typical daemon message
        is like this (shortened)
 
            From: Mail Delivery Subsystem 
<MAILER-DAEMON(_at_)my(_dot_)domain(_dot_)com>
            Subject: Warning: could not send message for past 4 hours
 
            The original message was received at...
            ----- Transcript of session follows -----
            Deferred: Connection timed out
            ----- Original message follows -----
            [YOUR MESSAGE AS YOU SENT IT WITH HEADERS]
 
        Well, when I read the subjects, I do not like the standard error
        messages, but I also like to know to which address the delivery
        failed and what was the original subject. This small recipe changes
        the daemon message's Subject to
 
            Subject BRIEF-ERROR-REASON, SENT-TO-ADDRESS, ORIGINAL-SUBJECT
 
        and from that you can immediately tell if you should be worried Eg.
        if SENT-TO-ADDRESS was your friend's, then you want to take actions
        immediately, but if it were your complaint to UBE message to
        postmaster, you don't want to bother reading that daemon message.
        Here are some real examples:
 
            fatal errors,postmaster,ABUSE (Was: Super Cool Site!)
            Host unknown,postmaster,ABUSE (Was: A-Credit Information)
            undeliverable,postmaster,Could you investigate this spam
            Warning-Returned,friend,Have you looked at this

    Call arguments (variables to set before calling)
 
        o   JA_DAEMON_REGEXP,   which messages to trigger
 
    Return values
 
        o   Variable ERROR will be set to "yes" if daemon message was handled
            otherwise; value is "no"
 
    Usage example
 
        Just add this recipe somewhere in your .procmailrc. The place where
        you would put this daemon message trapper subroutine is crucial:
        think carefylly how you order your recipes. One suggested order
        could be: backup important messages, cron-subroutine,
        handle duplicates, DAEMON MESSAGES, plus addressed message,
        server message (file server, ping responder...), MAILING LISTS,
        send possible vacation  replies only after all above, apply
        kill file, detect mime, save private messages and las FILTER UBE.
 
 
            PMSRC           = $HOME/pm
            RC_DAEMON       = $PMSRC/pm-jadaemon.rc
            DAEMON_MBOX     = $HOME/Mail/junk.daemon.mbox
 
            ...
 
            INCLUDERC       = $RC_DAEMON
 
            :0 :            # If that was a daemon message, put it to folder
            * ERROR ?? yes
            $DAEMON_MBOX
<Prev in Thread] Current Thread [Next in Thread>