First I made the following file for the SQL query, I called
it postfix-mbox-full-pgsql.cf (per some naming convention).
----------
# the user name and password to log into the pgsql server
user = <user>
password = <password>
# the database name on the servers
dbname = dbmail
# the table name
table = dbmail_users
# We want to write our own query
query = SELECT '522 Users mailbox is full' AS user_idnr
FROM dbmail_users
WHERE userid = '%s' AND
curmail_size >= (maxmail_size - 512000) AND
maxmail_size != 0
# the hosts that postfix will try to connect to
# and query from (in the order listed)
hosts = gcdb1
# end postgresql config file
----------
Then I put the following in my main.cf
----------
# Define what tables can be proxied for SQL lookups
proxy_read_maps = $local_recipient_maps $relay_recipient_maps
proxy:pgsql:/sql-configs/postfix-mbox-full-pgsql.cf
# Recipient restrictions
#
smtpd_recipient_restrictions =
... <other options here> ...
# Don't queue messages for full boxes.
check_recipient_access
proxy:pgsql:/sql-configs/postfix-mbox-full-pgsql.cf
... <other options here> ...
----------
Please note the proxy_read_maps line. Make sure that you have all the
items you want proxy SQL lookups for in that line. If you forget
something
it will not work and your log will have a lot of complaints in it.
I already do a lookup if the user exists, so I just proxy another SQL
query. The query is based on the idea that your "hard" quota is a bit
higher than the "soft" quota the user sees. The reason for this is I
don't have access to the message size at this point to check, so it's
impossible to know if it will fit or not.
If you want an absolute check you will need to use the pre-queue
filter option available in the later versions of Postfix and read
the entire message in to determine size.
For me, most people that are close to quota are just not checking their
box and letting it fill with SPAM so I don't care.
--
David A. Niblett | email: [EMAIL PROTECTED]
Network Administrator | Phone: (352) 334-3400
Gainesville Regional Utilities | Web: http://www.gru.net/
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Aleksander
Sent: Tuesday, September 26, 2006 11:37 AM
To: DBMail mailinglist
Subject: Re: [Dbmail] Postfix + dbmail-lmtpd
Niblett, David A wrote:
> So I just look for users at >= 20M and reject message at that point.
>
> If anyone wants the query or such, let me know.
Hi,
I'd like to see that one. Could you post on the list?
Thanks,
Alex
_______________________________________________
Dbmail mailing list
[email protected] https://mailman.fastxs.nl/mailman/listinfo/dbmail