procmail
[Top] [All Lists]

Re: Generating mailbox full errors

1998-04-16 00:44:41
Tom Marshall asked,

| Occasionally, I'll see a bounce message from another mailer (usually a
| spammer's mailbox on a free email site) that says "mailbox full".  We have
| problems with some users that have extremely large mailboxes and we'd like
| that capability -- Just a simple check to see if
| /var[/spool]/mail/USERNAME is under a predetermined size regardless of the
| actual message size.
|
| Unfortunately, I don't know of any way to accomplish this with sendmail.

There should be a way to do it with the MTA or in the OS; if there is,
procmail will obey it.  If not, it can be simulated in procmail.

| I was hoping that there was an efficient way to make an /etc/procmailrc that
| checks a recipient's mailbox size before attempting delivery.  I assume that
| a recipe could spawn a script to check but that seems terribly slow and
| inefficient.

Try this out ..

 max_spool_size=[fill in the number, in bytes]

 current_spool_size=`wc -c < $ORGMAIL` # "<" keeps filename out of output

 :0 # use `c' flag here if you want to deliver anyway
 * $ $current_spool_size^0
 * $ -$max_spool_size^0
 routine_for_boxes_that_are_too_full

If you want to include the current message in the calculation, that's easy
to add; use the same two assignments and then add one condition to the
recipe:

 :0 # use `c' flag here if you want to deliver anyway
 * $ $current_spool_size^0
 * $ -$max_spool_size^0
 * 1^1 > 1
 routine_for_boxes_that_are_too_full

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