procmail
[Top] [All Lists]

Re: checking a mailbox quota

2000-03-29 20:57:10
Gjermund Sorseth <gjermund(_at_)nextra(_dot_)com> writes:
...
In the recipe below, `mailquota' is a program that takes a
username as argument. It checks the size of the users mailbox and
exits 0 if he is below his quota, otherwise 1.

Does this look ok?

  :0
  * !? mailquota $LOGNAME
  {
       # Exit here and bounce the message if the mailbox was full.

       EXITCODE = 69
       HOST
  }

  # Continue processing the procmailrc here if below quota.


I suppose the mailquota program could also write something like
"mailbox quota exeeded" to stderr to appear in the bounced message,
but in this situation it would perhaps be nice if procmail had an
`echo' builtin command?

How about the LOG variable?  This won't work if you've already set
LOGFILE, but if you have a recent enough OS then you may be able to
workaround this by setting LOGFILE to /dev/fd/2 inside the block, ala:

        :0
        * !? mailquota $LOGNAME
        {
            # Exit here and bounce the message if the mailbox was full.
            LOGFILE = /dev/fd/2
            LOG = "mailbox quota exceeded by $LOGNAME
        "
            EXITCODE = 69
            HOST
        }


Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>