procmail
[Top] [All Lists]

Re: procmail and deliverquota exitcode

2006-07-16 04:21:39
On Sun, Jul 16, 2006 at 11:28:12AM +0200, Lucien GENTIS wrote:

Courier-imap deliverquota program (which delivers mail in
mailboxes), return an exitcode of 77 if the mailbox is over
quota.

So I would like to know if it is possible to use this exitcode
in a procmailrc file to send an automatic reply to the sender
telling him the mailbox is full.

Lucien,

We've discussed this in the past, so the first placed I'd check
would be the searchable archives at the site in the footer to
messages on this list.

I think the first answer is probably going to be, why aren't you
doing this in within your mail server at time of negotiation rather
than in procmail?  Then you could reject the message at the point
of the sender's interaction with your server.

Something like this might work, but this is quite untested:


   :0 w:   # note the flag
   $DEFAULT

   MAXINT = 2147483647
   :0 E h
   * !^FROM_DAEMON
   * !^X-Loop: your(_at_)own(_dot_)mail(_dot_)address
   *           78 ^0
   * $   -$MAXINT ^0
   * $ -$EXITCODE ^0
  #
  # If we're still here, EXITCODE was under 78
  #
   * $  $EXITCODE ^0
   * $    $MAXINT ^0
   *          -78 ^0
  #
  # We should be back to zero, so test for not below 77
  #
   * $  $EXITCODE ^0
   *          -76 ^0
   | (formail -r -I"Precedence: junk"      \
       -A"X-Loop: your(_at_)own(_dot_)mail(_dot_)address" ; \
      echo "User over quota.") | "$SENDMAIL" "$SENDMAILFLAGS" -t


Again, I have no idea if that will work or if I've got the logic
right.  Another way to go might be with the TRAP statement.

Dallman

____________________________________________________________
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