This note is a supplement to the virtual domain mail setup. I assume that you are delivering to a Maildir, I have not tried this with other delivery formats.
In my configuration I have added a fixed, global quota for all virtual users. This involves two changes:
virtual_delivery:
driver = appendfile
directory=${extract {homedir}{${lookup mysql{USER_QUERY}}}{$value}fail}/Maildir
delivery_date_add
envelope_to_add
return_path_add
user = mail
maildir_format
maildir_use_size_file
quota = 20M
quota_warn_threshold = 75%
Exim will automatically create the control files that are needed
also by Courier-IMAP.
# Immediate bounce of over-quota messages * quota #Catchall rule for other errors * * F,2h,15m; G,16h,1h,1.5; F,4d,6hThe ordering of the lines is important.
If you want per domain or per user quotas you will have to replace quota = 20M by a suitable lookup e.g.
quota = ${lookup mysql{select quota from Domains where domain='$domain'}{$value}{10M}}
assuming that you have the appropriate table structure set up.