Mohan Nakka | 8 Oct 2008 22:51
Picon

maildroprc for managing overquota notifications

Hello,
    I have mailserver setup with postfix+mysql+courier with maildrop as the delivery agent for virtual users.  I would like to send a custom bounce message  to the sender notifying that the recipients mailbox is full.

master.cf file has:

maildrop unix - n n - - pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -w 95 /etc/maildroprc -d ${user} <at> ${nexthop} ${extension} ${recipient} ${user} ${nexthop} ${sender}

Which sends a warning message to the mailbox owner when the mailbox hits 95%. This part works well. Currently, /etc/maildroprc file contains filtering for vacation/autorespond.

I would like to have filtering done for quota, so that when the mailbox hits the quotalimit, the sender receives a custom message.

So far I have tried something like the following in /etc/maildroprc just for quota: The problem is that, it is not able to catch the RETURNCODE of 77 to process the custom message, since xfilter returns either 0 or 1. How do I go about solving this?

Thanks much...

---------------------
VERBOSE="9"
EXTENSION="$1"
USER="$5"
HOST="$6"
FROM="$USER <at> $HOST"
HOME="/home/vmail"
DEFAULT="$HOME/$HOST/$USER/Maildir"

logfile "/tmp/maildrop.log"

`test -e $DEFAULT/maildirsize`
if (RETURNCODE == 0)
    {
     MAILDIRQUOTA=`/usr/bin/head -n1 $DEFAULT/maildirsize`
    }

`test -x /usr/bin/deliverquota`
if (RETURNCODE == 1)
{
      log " WARNING: no deliverquota!"
}
else
{
     if (RETURNCODE == 77)
       {
          log " Over Quota. Current size $MAILDIRQUOTA"
          to "| mailbot -t /tmp/fullwarning.txt /usr/sbin/sendmail -t -f ''"
       }
     else
       {
          exception {
              xfilter "/usr/bin/deliverquota -w 95 $DEFAULT"
              log "Delivered to $DEFAULT"
           }

          if (RETURNCODE == 0)
            {
                log "success quota $MAILDIRQUOTA"
                to "$DEFAULT"
                #   EXITCODE=0
                #    exit
            }
          else
            {
                log "different error code"
            }
        }
}
----------------------------------------


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Courier-maildrop mailing list
Courier-maildrop <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/courier-maildrop

Gmane