procmail
[Top] [All Lists]

Re: procmail to enforce mailbox quotas?

2003-02-21 22:25:36
On Tue, Feb 18, 2003 at 01:39:31PM -0800, Dan Hollis wrote:
Anyone have nice /etc/procmailrc to enforce system-wide quotas on users 
mailboxes? Eg allow user mailboxes up to 50 megabytes, then send nice 
bounce messages to the sender.

You could try this (might need a DROPPRIVS: can anyone help?):

NL="
"
## QUOTA = 50 * 1024 * 1024
QUOTA=52428800
INBOXSIZE=`ls -l $DEFAULT 2>/dev/null | awk '{print $5}'`
:0
* $ -${INBOXSIZE}^0
* $ ${QUOTA}^0
{
    MAXMSG = $=
    :0
    * $ > ${MAXMSG}
    {
        LOG="Bouncing (message too big!)${NL}"
        EXITCODE=69
        HOST
    }
}

:0E
{
    LOG="Bouncing (inbox already full!)${NL}"
    EXITCODE=69
    HOST
}

Caveats:

The bounce works just fine, but for some strange reason my setup also
delivers the message as usual (I have a slightly hacked procmail
3.22). Maybe yours will work just fine.

Scott
-- 
Scott Wiersdorf
scott(_at_)perlcode(_dot_)org

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