[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vps-mail] how to catch emails with long subjects?



On Fri, Apr 23, 2004 at 10:50:37AM -0400, Chris Edwards wrote:
> 
> Hi
> 
> I was wondering what a procmail recipie would be that would count the 
> chars in a subject line and if they were over a certain number send them 
> to a spam file.

This might work:

<snip>
MAX_SUBJECT_CHARS=25

## grab subject
:0
* ^Subject:\/.*
{
    SUBJECT = $MATCH

    ## strip off leading spaces, if any
    :0
    * SUBJECT ?? [      ]*\/[^  ].*
    { SUBJECT = $MATCH }

    ## count chars in subject
    :0
    * $ -${MAX_SUBJECT_CHARS}^0
    *                       1^1 SUBJECT ?? .
    {
        ## count total number of chars
        CHARS = $=
        :0
        * $             ${CHARS}^0
        * $ ${MAX_SUBJECT_CHARS}^0
        { LOG="Reason: Subject contains $= characters${NL}" }

        ## put this message somewhere special
        :0:
        $PMDIR/subject_too_big
    }
}
</snip>

Scott
-- 
Scott Wiersdorf
scott@xxxxxxxxxxxx
======================================================================
This is <vps-mail@xxxxxxxxxxxx>       <http://www.perlcode.org/lists/>
Before posting a question, please search the archives (see above URL).


Main Index | Thread Index
Match: Format: Sort by:
Search: