procmail
[Top] [All Lists]

Re: procmail and deliverquota exitcode

2006-07-16 06:03:42
On Sun, Jul 16, 2006 at 01:16:42PM +0200, Dallman Ross wrote:

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.

Hmm.  I still don't know for sure that the above will work,
though I think it will.  But assuming so, here is an easier way
to do the same.  (Again, I still think TRAP would be even better,
but I am not in a place right now where I can research that
syntax, and it eludes me without cribbing.)


     :0 w:   # note flag
     $DEFAULT

     :0 E h
     * !^FROM_DAEMON
     * !^X-Loop: your(_at_)own\(_dot_)mail\(_dot_)address
     * EXITCODE ?? ^^77^
     | (formail -r -I"Precedence: junk"      \
         -A"X-Loop: your(_at_)own(_dot_)mail(_dot_)address" ; \
        echo "User over quota.") | "$SENDMAIL" "$SENDMAILFLAGS" -t


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