1

Topic: Dovecot quota

- iRedMail version: 0.8.5
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: CentOS 6.5
- Related log if you're reporting an issue:
====

Hello community !

Got my Dovecot quota settings with:

#> dovecot -n
...
quota = dict:user::proxy::quotadict
quota_rule = *:storage=100M
quota_warning = storage=85%% quota-warning 85 %u
quota_warning2 = storage=90%% quota-warning 90 %u
quota_warning3 = storage=95%% quota-warning 95 %u
...

#> cat dovecot-mysql.conf

driver = mysql
default_pass_scheme = CRYPT
connect = host=127.0.0.1 dbname=vmail user=vmail password=******
# Required by 'doveadm mailbox ...'.
iterate_query = SELECT username AS user FROM mailbox
password_query = SELECT password FROM mailbox WHERE username='%u' AND active='1'
user_query = SELECT \
    CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
    CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule \
FROM mailbox,domain \
WHERE mailbox.username='%u' \
    AND mailbox.domain='%d' \
    AND mailbox.`enable%Ls%Lc`=1 \
    AND mailbox.domain=domain.domain \
    AND domain.backupmx=0 \
    AND domain.active=1 \
    AND mailbox.active=1

#> cat dovecot-quota-warning.sh

PERCENT=${1}
USER=${2}

# Use "plugin/quota=maildir:User quota:noenforcing" for maildir quota.
cat << EOF | /usr/libexec/dovecot/deliver -d ${USER} -o "plugin/quota=dict:User quota::noenforcing:proxy::quota"
From: no-reply@domain.com
Subject: Mailbox Quota Warning: ${PERCENT}% Full.

Your mailbox is now ${PERCENT}% full, please clean up some mails for
further incoming mails.

EOF


Question: If I create a user with iRedAdmin (FREE) setting his quota up to 250Mb and knowing that dovecot rule is set to 100Mb, will this user be warned at 90% at his 250Mb quota ? Or will be ignored as dovecot only can manage quota warnings up to 100Mb ?

Thank you for your information.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Dovecot quota

As you can see in dovecot-mysql.conf, Dovecot will get user quota setting from column 'mailbox.quota':

user_query = SELECT \
    ...
    CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule \

'quota_rule =' in Dovecot is used as default quota if SQL query doesn't return 'quota_rule'.

To understand how quota warning works, please refer to this tutorial:
http://wiki2.dovecot.org/Quota/Configur … a_warnings

3

Re: Dovecot quota

... for each user quota!

CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule

Thank you ZhangHuangbin!