procmail
[Top] [All Lists]

procmailrc to match body

2015-01-31 15:17:11
I wrote a set of procmailrc recipes to "quarantine" certain category of
incoming mails to my site. It works with 3 simple steps: when a mail meets
certain criteria, it triggers a "quarantine" process by (1) holding the
mail while send a confirmation mail to the sender; (2) when the
confirmation mail is replied by the sender, the mail gets delivered
normally; (3) when the confirmation mail is bounced, the mail is trashed.

So far everything worked well.

Lately I noticed a minor problem with my recipes to recognize certain
bounced mails (a small proportion of all bounced).

My recipe to catch bounces is like:

:0
* ^FROM_DAEMON|^FROM_MAILER
* ^To:.*(mailmaster(_at_)xxxxxx(_dot_)xxx)
{
   :0 B
   * ^.*Verify the mail you sent: \/[0-9a-zA-Z\.]+
   {
     MATCHED="$MATCH"

     :0 fw
     | cat "$MAILDIR/QUARRENTEEN/$MATCHED" >> $SPAM;

     :0 a
     | echo 'bounced, go to spam' > "$MAILDIR/QUARRENTEEN/$MATCHED"
   }

   :0 e
   /var/mail/Mail-error
}

which works well for most except one type of bounces from certain mail
daemon, with multi-parts:

----------start quote---------------------
From: Mail Delivery Subsystem <MAILER-DAEMON(_at_)xxxxxx(_dot_)xxx>
Subject: Returned mail: see transcript for details

(omitted)

   [ Part 2: "Delivery Status" ]

(omitted)

   [ Part 3: "Included Message" ]

 Date: Wed, 28 Jan 2015 14:05:32 -0600
 From: mailmaster(_at_)xxxxxxxx(_dot_)xxx
 To: xxxxxxxxxxxxx(_at_)xxxxxxxxxxxxxxx(_dot_)us
 Subject: Verify the mail you sent: 20150128.140532KAMGTNXTV

 This mail hub is withholding a mail just received from you:
  - sent to <xxxxxxxx(_at_)xxxxxxxxxx(_dot_)xxx>
  - with the Subject: "Find lost or stolen items from your iPhone."

 This is to verify that the mail from your mailbox is not a spam.
 Please confirm by replying this mail (no need to write anything;
 only be sure to include this mail in the reply, and leave the Subject
 line and mail body as they are):

   Verify the mail you sent: 20150128.140532KAMGTNXTV

 Your mail will be automatically delivered when the system receives
 this confirmation from you.

 Thank you.
----------------end quote-----------------------

which fell into "Mail-error". It appears the body match failed. Any advice
how the recipe should be modified in order to catch this?

Thanks, joe
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
<Prev in Thread] Current Thread [Next in Thread>