Elliot Finley wrote:
> I'm using a quota in my transport which works, but it generates
> bounces (which usually get stuck in the queue because of invalid
> return addresses). Is there any way to issue a 550 at RCPT time for a
> full box?
rcpt_chk_quota:
# OK if no local deliveries
require set acl_c7 = 1000M
set acl_c5 = 0
accept condition = ${if !match {$acl_c9}{/(,|\$)}}
# Get the deliver directory
require set acl_c8 = ${sg {$acl_c9} {([^/],)*(.*/(,|\$))} {\$2}}
require set acl_c8 = ${sg {$acl_c8} {(.*/Maildir/).*\$} {\$1}}
# If it doesn't exist either it's never been created or
# we're on a 2MX. Check the DB for an over-quota flag.
accept condition = ${if !exists{$acl_c8}}
acl = quota_db_flag
# Get the path to the maildirsize file; if it's not present then either it's
# never been created, it's been temporarily deleted.
accept condition = ${if !exists{${acl_c8}maildirsize}}
acl = quota_longform
# read the size file
require set acl_c8 = ${readfile{${acl_c8}maildirsize}{!}}
# empty first line means infinite quota
accept condition = ${if match {$acl_c8}{^\\s*(!.*)?\$}}
set acl_c7 = 0
# quota: first line, first number
require set acl_c7 = ${sg {$acl_c8} {^(\\s*)(\\d+).*\$} {\$2}}
# zero means infinite quota
accept condition = ${if = {$acl_c7}{0}}
# drop the first line
warn set acl_c8 = ${sg {$acl_c8}{^[^!]*!(.*)\$} {\$1}}
# convert 2nd number & linebreak into addition, on each line
set acl_c8 = ${sg {$acl_c8}{\\s*(-?\\d+)[^!]*!?} {\$1 +}}
# evaluate the sum (and leave around for the data-time check)
set acl_c5 = ${eval:$acl_c8 +0}
# add this message (10k default if no SIZE=)
set acl_c8 = ${eval:$acl_c5 + ${if < {$message_size}{0} \
{10K} {$message_size}}}
# ok if within quota
accept acl = acl_chk_quota
# might have deferred there, or denied.