procmail
[Top] [All Lists]

Re: Procmail und Quota

2007-02-19 07:09:37
Martin Hochreiter a écrit :
    Normaly, the sender will get an error message to say:
...
----- Transcript of session follows -----
procmail: Quota exceeded while writing ...
    
Thats what I expected - but there is no action from procmail.
I have configured procmail now to check and send the mail itself,
but a "builtin solution" would be better.


my script (if you have maybe a better solution):

USER=`echo $DEFAULT | cut -d"/" -f3 | sed s/\\\./_/g`
QUOTA= `quota -u $USER | tail -n 1 | awk '{print \$3}'`
INBOXSIZE=`du -s /home/test.account/Maildir/ | awk '{print \$1}'`
DROPPRIVS=yes

:0
* $ -${INBOXSIZE}^0
* $ ${QUOTA}^0
{
    MAXMSG = $=
    MAXMSGK=`echo "$MAXMSG*1024" | bc`
    :0
    * > ${MAXMSGK}
    {
        REC=`formail -zx"To:"`
        LOG="Mail to big for account $REC"
        EXITCODE=0
        :0
        * ^X-Loop: bounce(_at_)postfix-howto(_dot_)de
        /dev/null
        :0
        | formail -rk -I"Subject: Mailsize to big for account $REC" \
         -A"FROM: $DAEMON" -A"Precedence: junk" \
         -A"X-Loop: bounce(_at_)postfix-howto(_dot_)de" | $SENDMAIL -t
     }
}
:0E
{
    :0 w
    {
        REC=`formail -zx"To:"`
        LOG="Mailsize exceeded for account $REC"
        EXITCODE=0
        :0
        * ^X-Loop: bounce(_at_)postfix-howto(_dot_)de
        /dev/null
        :0
        | formail -rk -I"Subject: Mailbox full for account $REC" \
         -A"FROM: $DAEMON" -A"Precedence: junk" \
         -A"X-Loop: bounce(_at_)postfix-howto(_dot_)de" | $SENDMAIL -t
    }
}


____________________________________________________________
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

  
deliverquota returns 77 as error code when mailbox is full, so
here is a piece of my .procmailrc, beginning with mail delivery through 
deliverquota:

| /usr/local/courier-imap/bin/deliverquota -w 90 <user-maildir>

DELQUOTA = $?

:0
* DELQUOTA ?? ^^77^^
| (/usr/bin/formail -r -X "" -I"From: postmaster(_at_)${DOMAIN}"; echo -e 
"Mailbox full") | $SENDMAIL -t $SENDMAILFLAGS



-- 
Lucien GENTIS
IUFM de Lorraine
Centre de Ressources Informatiques
5, Rue Paul Richard
C.O. 3 - MAXEVILLE
54528 LAXOU-CEDEX

Tél. 03 83 17 68 41
Email : lucien(_dot_)gentis(_at_)lorraine(_dot_)iufm(_dot_)fr


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