procmail
[Top] [All Lists]

Re: Recipe question

2003-12-18 19:58:57
Sean wrote:

So long as I don't see many more $VACATION messages...

Out of curiosity, does anyone have a good recipe to classify these "out
of office" messages? I've been using the recipe below, but it's probably
too general to work with larger mail volumes. $SUBJECT and $TO are
extracted from their respective headers, as appended below.

OOFFICE   = "(out of (the )?office|away from my mail)"
AREPLY    = "auto(reply|matic\ reply|responder)"
PHONE_NUM = "[0-9][0-9][0-9](-|\.)[0-9][0-9][0-9](-|\.)[0-9][0-9][0-9][0-9]"
CUR_MONTH = `date '+%B'`

# ------------------
# Autoreplies are always directly addressed to you.
# ------------------
:0
* $ TO ?? ^^${MYNAME}
{
        # ------------------
        # Trivial Case #1
        # Message subject contains vacation verbiage
        # ------------------
        :0
        * $ SUBJECT ?? ${OOFFICE}
        { SOURCE = ooffice }

        # ------------------
        # Trivial Case #2
        # Message body is very small and contains vacation verbiage
        # ------------------
        :0B
        * < 300
        * $ ${OOFFICE}
        { SOURCE = ooffice }

        # ------------------
        # Hard Case #1
        # Message is large and either contains obvious 
        # or strongly suggestive vacation verbiage.
        # ------------------
        :0B
        * < 1500
        * -1^0
        *  2^0 $ ${OOFFICE}
        *  1^0 $ (until|through) ${CUR_MONTH} [0-9]
        *  1^0 $ ()\<${PHONE_NUM}\>
        {
                # ------------------
                # Verify the message is an autoreply, using
                # either Precedence header or autoreply
                # verbiage.
                # ------------------
                :0B
                * -1^0
                *  2^0   H ?? ^Precedence: (bulk|junk)
                *  2^0 $ B ?? ${AREPLY}
                *  1^0 $ H ?? ${AREPLY}
                *  1^0 < 500
                { SOURCE = ooffice }
        }
}


# header extractions
:0
* ^To:[         ]+()\/.*
{ TO = ${MATCH} }

:0
* ^Subject:[    ]+()\/.*
{ SUBJECT = ${MATCH} }                                                     

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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