Postfix does not support mailbox quota. But thanks to Anderson Nadal’s Postfix Virtual Delivery Agent (VDA) patches, it can. To use the Postfix VDA requires two things, first Postfix must be built with the VDA patches and second, virtual user accounts must be used. You can get the Postfix RPM with VDA patches here.
Here are some configuration you can use for your virtual accounts.
Configure Postfix VDA

1. Edit the postfix configuration file /etc/postfix/main.cf and add the lines below
virtual_mailbox_limit_override = yes virtual_overquota_bounce = yes virtual_mailbox_limit_maps = hash:/etc/postfix/vquota

2. Create the file /etc/postfix/vquota containing the mapping from an email address to the maximum mailbox quota in bytes. If you wish to be exact, 1KB equals 1024 bytes while 1MB equals 1024KB or 1048576 bytes.
johndoe@acme.local 10485760 janedoe@acme.local 2097152
John Doe got a 10MB quota while Jane Doe got 2MB.
After creating this file, execute postmap /etc/postfix/vquota. This will generate /etc/postfix/vquota.db, the actual file that will be used for the lookup.
If you use Active Directory as your Postfix virtual user accounts source, you can use the maxStorage attribute instead to store the quota. Just copy your ldap-users.cf configuration and save it as ldap-quota.cf. Next change samaccountname to maxstorage in the result_attribute line and remove the result_format line. In your main.cf, use ldap:/etc/postfix/ldap-quota.cf as your virtual_mailbox_limit_maps. In Windows, you can use ADSI Edit to access and modify the value of maxStorage.

3. Restart the Postfix or MailScanner service if you have installed MailScanner. Learn how to start and stop services here.
4. Test Postfix using Telnet. Try using a very small quota limit so you can test the quota feature.Visit the forum to ask for help or to give a comment.
***
Posted on 4/20/2008 and last updated on 6/26/2010
Filed under Postfix
April 27th, 2008 at 12:08 pm
Hi,
How do I know if my postfix version installed has the VDA patch? Will using your postfix version(the one patched already) be as easy as upgrading the built-in postfix of CentOS 5?
April 27th, 2008 at 12:28 pm
Hi,
A question on this line:
In your main.cf, use ldap:/etc/postfix/ldap-quota.cf as your virtual_mailbox_limit_maps.
Does this mean that I will replace virtual_mailbox_maps with the line above or just add the line above in the bottom?
April 28th, 2008 at 12:23 am
I don’t know of any command to check for the presence of VDA and installing the patched one is as easy as upgrading the built-in Postfix.
April 28th, 2008 at 12:24 am
Yes correct, you will replace virtual_mailbox_maps with the ldap version.
July 31st, 2008 at 11:48 am
hey dude, just to clarify things to avoid misconception, “Postfix does not support mailbox quota.”. There are two types of how an MTA saves our mail, 1 is the traditional unix “mailbox” which saves all of your emails on a single file, on most cases (depending or your distro) it is stored at /var/spool/mail. The other one is Maildir/ which is more efficient way of storing mails. VDA patch only works with Maildir/ formats so as its quota features, i think that is should be “Mail Quota” instead of “mailbox quota” cause that would confuse some of the people who reads it and led them to thinking that your pertaining to the traditional “mailbox” method of storing mails..
cheers.. keep it up.
August 8th, 2008 at 3:09 pm
Hi netbeui,
The Postfix Quota patch works with both Mailbox and Maildir format. The only requirement is to use virtual accounts.
From the website:
Mailbox / Maildir size limit, known also as “soft quota”, to avoid user take all you disk space
I’ve also tried it myself and it works.
November 21st, 2008 at 3:58 am
I have my Postfix Mail Server with Ldap for virtuals users. I upgraded Postfix with VDA.
I configured virtual_mailbox_limit_maps = ldap:/etc/postfix/ldap-quota.cf
server_host = localhost
search_base = dc=runiversal,dc=com
version = 3
query_filter = (&(objectclass=person)(mail=%s))
result_attribute = maxstorage
bind = yes
bind_dn = cn=manager,dc=runiversal,dc=com
bind_pw = password
The question is: How do I apply the size of the disk quota for each user? In what file you drop?
November 23rd, 2008 at 11:47 pm
Hi elXesar,
You assign the quota size into the maxstorage attribute. But maxstorage is available only on Active Directory so if you are using OpenLDAP or Fedora Directory Server, you need to use a different attribute. FDS includes it’s own LDAP editor, for OpenLDAP you can use JXplorer.
February 17th, 2009 at 12:07 pm
Could you tell me which attribute should I use in openLDAP in place of MaxStorage.
Thankx.
February 17th, 2009 at 4:13 pm
Hi Parvez,
There’s no built-in alternative available in OpenLDAP, you’ll have to extend the OpenLDAP schema see
http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Deployment_Guide-en-US/s1-ldap-files-schemas.html
February 17th, 2009 at 9:44 pm
First, thanks for your great site.
I installed your postfix rpm with VDA and I could use with my LDAP and the quota works ok. Is there a command to know the used quota for a user or all users?
February 18th, 2009 at 12:49 am
Hi Carlos,
There’s no SMTP command for this. You’ll have to check the mailbox storage in Linux, see
http://www.linuxquestions.org/questions/linux-server-73/how-to-determine-mailbox-size-postfix-646984/
March 25th, 2009 at 7:53 am
Hi,
I had installed Postfix 2.5.2 and dovecot 1.0.13 on my mailserver. I couldnt find a patch for that version of Postfix. I setup quota support on dovecot, but it didnt work. Is it because there is no quota support for Postfix? Is upgrading Postfix the only solution?
March 25th, 2009 at 12:33 pm
Hi femitha,
That’s right. You need quota support in Postfix. You can build your own Postfix package or use my custom built Postfix packages.
July 16th, 2009 at 10:33 am
Hi,
I have problem running this line “getent passwd ….”, looks like something is missing or imcomplete, can someone show me the complete command line?
Also, where I store the user passwords?
Thanks
TGO
July 20th, 2009 at 4:19 pm
Thanks for nice article. But i am facing some problem. please help me.
is johndoe system user??
How can i access Virtual User mailbox through webmail or outlook?
July 20th, 2009 at 4:40 pm
how can i create virtual user account and access their mail??
July 21st, 2009 at 10:24 am
Virtual USer Mail goes to /new directory not
INBOX. Then How can I access the /new DIR mail.