How to Set Up Email Quotas and Storage Limits

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

Browse more articles in Email Hosting & Deliverability.

  • dovecot email quota, mailbox storage limit, email quota configuration, dovecot quota plugin
  • 0 Utenti hanno trovato utile questa risposta
Hai trovato utile questa risposta?

Articoli Correlati

How to Set Up a VPS for Email Marketing (Complete Guide)

Running your own email marketing infrastructure on a VPS gives you full control over...

How to Configure SPF, DKIM, and DMARC (Complete Guide)

SPF, DKIM, and DMARC are the three DNS-based email authentication standards that Gmail, Outlook,...

How to Set Up Reverse DNS (PTR/rDNS) for Email Deliverability

Reverse DNS (PTR record) maps your server's IP address back to a hostname — the opposite of...

IP Warm-Up: A Safe 30-Day Schedule for New Sending IPs

Mailbox providers like Gmail and Outlook monitor sending behavior closely and treat sudden...

Best Email Marketing Software for a VPS (MailWizz, Mautic, Listmonk & More)

Choosing the right self-hosted email marketing platform affects deliverability, ease of...