Without quotas, a single mailbox can grow unboundedly, consuming disk space and potentially affecting other mailboxes/services on the same server. This guide covers configuring per-mailbox storage limits with Dovecot.
Why Quotas Matter
An unmonitored mailbox (especially one receiving significant automated mail, or simply never cleaned up) can grow to consume substantial disk space over time — quotas prevent any single mailbox from affecting overall server disk health.
Enabling Quota Support in Dovecot
sudo nano /etc/dovecot/conf.d/90-quota.conf
plugin {
quota = maildir:User quota
quota_rule = *:storage=1G
}
Sets a default 1GB quota per mailbox — adjust based on your actual storage capacity and typical user needs.
Enabling the Quota Plugin
sudo nano /etc/dovecot/conf.d/10-mail.conf
mail_plugins = $mail_plugins quota
Enabling for IMAP Specifically
sudo nano /etc/dovecot/conf.d/20-imap.conf
mail_plugins = $mail_plugins imap_quota
Lets IMAP clients actually see and display quota usage/limits to users, not just enforce them silently.
Setting Per-User Quotas (Database-Backed, for Multi-Domain Setups)
quota_rule2 = Trash:storage=+100M
For virtual/database-backed mail setups (see How to Set Up Multiple Domains on One Mail Server), quota values can be stored per-user in your database rather than a single server-wide default, allowing different limits for different users/plans.
Restart Dovecot
sudo systemctl restart dovecot
Checking a User's Current Quota Usage
doveadm quota get -u [email protected]
Notifying Users Approaching Their Quota
plugin {
quota_warning = storage=90%% quota-warning 90 %u
quota_warning2 = storage=80%% quota-warning 80 %u
}
Configures automatic warning notifications at specified usage thresholds, giving users advance notice before they hit their hard limit and start bouncing incoming mail.
What Happens When a Mailbox Exceeds Its Quota
New incoming mail is rejected/bounced (the sender receives a "mailbox full" bounce) until the user frees up space — existing mail isn't deleted automatically, but new mail can't be delivered until usage drops below the limit.
Setting Different Quotas for Different User Tiers
If offering different service levels, configure different quota amounts per user/domain based on their specific plan — particularly relevant for multi-tenant mail hosting scenarios.
Monitoring Overall Mail Storage Usage
du -sh /var/mail/vhosts/*
Periodically review overall mail storage consumption, even with per-user quotas in place, to ensure aggregate usage stays within your server's actual disk capacity.
Common Errors
Quota configured but not actually enforced — verify the quota plugin is correctly loaded in mail_plugins, and that Dovecot was properly restarted after configuration changes.
Continue Reading
- How to Install and Configure Dovecot for IMAP/POP3
- How to Set Up Multiple Domains on One Mail Server
- How to Check and Manage Disk Usage on a Linux VPS
Browse more articles in Email Hosting & Deliverability.