procmail
[Top] [All Lists]

Re: new recipe filter...

2008-07-26 14:33:44
At 11:17 2008-07-26 -0700, Jim Seavey wrote:
I have several users who receive email from one or more specific person(s) who think it is their appointed task in life to send out the absolute largest email's that they possibly can.

Yea, I appreciate the AOL'ers who forward lists of pictures from websites (such as worth1000) rather than, I dunno, a simple LINK to it.

The second thing the global procmail process does is send large email's directly to the users default incoming mail box; larger being greater than 2MB so they do not cause procmail problems.

Procmail problems? Please elaborate. I was unaware that procmail had problems with large messages.

The following is the filter to move large email's into the users home directory.

:0 f
* > 2048000
| ${FORMAIL} -A"X-Note: Oversize/Not Filtered"

Well, that doesn't actually _move_ the message anyplace - it merely adds a header to it. The following would actually set the header and deliver it:

:0
* > 2048000
{
        :0f
        | ${FORMAIL} -A"X-Note: Oversize/Not Filtered"

        :0:
        $DEFAULT
}


This recipe is run prior to the individual users procmail recipes. I would like to be able add a condition to this recipe that allows me to include specific From: email addresses that will send the large email being sent by specific email addresses to /dev/null and any others to be sent to the users default mail box. This way I can police the continual offenders who eat up disk space with this type of stuff.

Wow.

You do know that you COULD use an EXITCODE to cause procmail (as LDA, I presume) to return a faulire to the MTA.

See /usr/include/sysexits.h

So, rather than writing to /dev/null, set the EXITCODE to the numeric value for EX_CANTCREAT, which is 73:

{
        EXITCODE = 73
}

This would cause the MTA to generate an after-the-fact bounce to the sender. yea, more network bandwidth, but if the SENDER is reminded of their stupidity, perhaps they'll curb their useless posting...


How do I code this?


:0
* > 2048000
{
        OVERSIZE=Y

        :0f
        | ${FORMAIL} -A"X-Note: Oversize/Not Filtered"
}


# making this dependant upon the OVERSIZE variable, rather than the
# specific size means that you're checking the size only above, rather than
# having multiple checks throughout your code.  Using maximal scoring, each
# of the FROM addresses is merely an OR condition.  If this recipe were
# IMMEDIATELY following the size one, you could use the A flag here, or you
# could just take the content of the braced section and insert it after the
# formail stuff above.  All depends upon how many alternate paths you might
# have to setting conditions.
:0
* OVERSIZE ^^Y^^
{
        :0
        * 9876543210^0 ^From:(_dot_)*dumbass1(_at_)domain\(_dot_)tld
        * 9876543210^0 ^From:(_dot_)*dumbass2(_at_)domain\(_dot_)tld
        * 9876543210^0 ^From:(_dot_)*dumbass3(_at_)domain\(_dot_)tld
        * 9876543210^0 ^From:(_dot_)*dumbass4(_at_)domain\(_dot_)tld
        * 9876543210^0 ^From:(_dot_)*dumbass5(_at_)domain\(_dot_)tld
        /dev/null

        # if oversize, but not from a nimrod, then defauly deliver it.
        :0:
        $DEFAULT
}

This may sound Draconian to some but we do not have the luxury of allowing this kind of stuff eat up disk space; especially when people are out of the office and do not check their email for some time.

Find out what their personal mail account addresses are and forward the messages to them there <g>

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

____________________________________________________________
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>