Hi
Try:
SELECT quota AS userdb_quota/User quota/storage_size
in passdb/userdb sql query
Bogusław Juza
W dniu 31.08.2026 o 10:12, Alberto via dovecot pisze:
El 31/8/26 a las 7:11, Aki Tuomi escribió:
On 30/08/2026 21:44 EEST Alberto via dovecot <dovecot@dovecot.org> wrote:
I have dovecot 2.4.5 in a Docker container and warning quota of message count isn't working.
My quota config:
In storage option works ok, but in case of messages no event success. Log not show anything and external script is not call, of course. Any idea?
Best Regards, Alberto
How are you delivering mail to dovecot?
Aki
LMTP, attach wide doveconf...
2.4.5 (0cbb641e3e): /etc/dovecot/dovecot.conf
Pigeonhole version 2.4.5 (742bb892)
OS: Linux 4.15.0 x86_64 Debian 13.6
Hostname: db37d808b22b
3 default setting changes since version 2.4.5
dovecot_config_version = 2.4.5 auth_allow_cleartext = yes auth_allow_weak_schemes = yes auth_master_user_separator = * auth_mechanisms = plain login cram-md5 auth_verbose = yes auth_verbose_passwords = yes debug_log_path = /dev/stdout default_internal_user = vmail default_login_user = vmail deliver_log_format = msgid=%{msgid}: %{message} (subject=%{subject} from=%{from} To=%{to_envelope} size=%{size}) dovecot_storage_version = 2.4.5 first_valid_gid = 1000 first_valid_uid = 1000 fts_autoindex = yes fts_autoindex_max_recent_msgs = 999 fts_search_add_missing = yes import_environment { CORE_ERROR = %{env:CORE_ERROR} CORE_OUTOFMEM = %{env:CORE_OUTOFMEM} MALLOC_MMAP_THRESHOLD_ = 131072 PATH = %{env:PATH} TZ = %{env:TZ} } last_valid_gid = 1000 last_valid_uid = 1000 lmtp_rcpt_check_quota = yes lmtp_save_to_detail_mailbox = yes log_debug = category=sieve log_path = /dev/stdout mail_driver = maildir mail_gid = vmail mail_plugins { notify = yes mail_log = yes quota = yes } mail_uid = vmail protocols = imap lmtp sieve quota_message_count = 100000 quota_status_nouser = DUNNO quota_status_overquota = 452 4.2.2 Mailbox is full and cannot receive any more emails quota_status_success = DUNNO quota_storage_size = 3G sieve_execute_bin_dir = /etc/dovecot/sieve sieve_extensions { fileinto = yes reject = yes envelope = yes encoded-character = yes vacation = yes subaddress = yes comparator-i;ascii-numeric = yes relational = yes regex = yes imap4flags = yes copy = yes include = yes body = yes variables = yes enotify = yes environment = yes mailbox = yes date = yes index = yes ihave = yes duplicate = yes mime = yes foreverypart = yes extracttext = yes mboxmetadata = yes vnd.dovecot.debug = yes vnd.dovecot.pipe = yes vnd.dovecot.execute = yes imapsieve = yes } sieve_pipe_bin_dir = /etc/dovecot/sieve sieve_plugins { sieve_imapsieve = yes sieve_extprograms = yes } sieve_trace_debug = yes sieve_trace_dir = /var/mail/sieve-traces sieve_trace_level = matching sql_driver = mysql state_dir = /run/dovecot mysql mimariadb { dbname = xxxxxx password = # hidden, use -P to show it user = xxxxxxx } passdb sql { default_password_scheme = CRYPT query = SELECT username, domain, home AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, (CASE WHEN '%{mechanism}' = 'CRAM-MD5' THEN crampassword ELSE password END) AS password, CONCAT('*:bytes=',quota) AS userdb_quota_rule, CONCAT('*:messages=',quotamsgs) AS userdb_quota_rule3 FROM users WHERE username = '%{ user | username | lower }' AND domain = '%{ user | domain | lower }' AND active = 'Y' } userdb sql { iterate_query = SELECT CONCAT(username,'@',domain) AS user FROM users query = SELECT uid, gid, home, CONCAT(username, '@', domain) AS username, crampassword AS password, COALESCE(quota, 0) AS quota_storage_size, COALESCE(quotamsgs, 0) AS quota_message_count FROM users WHERE username = '%{ user | username | lower }' AND domain = '%{ user | domain | lower }' } auth_policy { hash_nonce = # hidden, use -P to show it server_api_header = Authorization: Basic d2ZvcmNlOmllcGE server_url = http://xxxxxxxx:8084 } namespace inbox { inbox = yes mailbox Drafts { special_use = "\\Drafts" } mailbox spam { auto = subscribe special_use = "\\Junk" sieve_script report-spam { cause = copy path = /etc/dovecot/sieve/report-spam.sieve type = before } } mailbox Trash { special_use = "\\Trash" quota_storage_extra = 100M } mailbox Sent { special_use = "\\Sent" } mailbox "Sent Messages" { special_use = "\\Sent" } mailbox SPAM { quota_hidden = yes } imapsieve_from spam { sieve_script report-ham { cause = copy path = /etc/dovecot/sieve/report-ham.sieve type = before } } } service imap { extra_groups = vmail } service imap-postlogin { executable = script-login /dovecot/albertobin/postlogin.sh user = $SET:default_internal_user unix_listener imap-postlogin { } } service imap-login { process_min_avail = 1 inet_listener imap { port = 0 } inet_listener imaps { port = 31993 ssl = yes } } service pop3 { } service pop3-login { inet_listener pop3 { } inet_listener pop3s { } } service submission { } service submission-login { client_limit = 100 process_min_avail = 1 inet_listener submission { port = 31587 } inet_listener submissions { port = 31465 ssl = yes } } service lmtp { executable = lmtp -L extra_groups = vmail unix_listener lmtp { group = vmail user = vmail } inet_listener lmtp { port = 31024 } } service auth { inet_listener auth { port = 12345 } unix_listener auth-userdb { group = mode = 0666 } } service auth-worker { } service dict { unix_listener dict { group = user = vmail } } service dict-async { unix_listener dict-async { group = mode = 0660 user = vmail } } service imap-hibernate { unix_listener imap-hibernate { group = vmail user = vmail } } service imap-urlauth-worker { extra_groups = vmail unix_listener imap-urlauth-worker { group = vmail user = vmail } } service indexer-worker { extra_groups = vmail unix_listener indexer-worker { group = vmail user = vmail } } service doveadm { extra_groups = vmail inet_listener http { port = 8080 ssl = yes } } service stats { process_min_avail = 1 unix_listener stats-writer { group = vmail user = vmail } inet_listener http { port = 9900 ssl = yes } } service anvil { extra_groups = vmail unix_listener anvil { group = vmail user = vmail } unix_listener anvil-auth-penalty { group = vmail user = vmail } unix_listener anvil-connect-limit { group = vmail user = vmail } } metric auth_success { filter = (event=auth_request_finished AND success=yes) } metric auth_failure { exporter = log filter = (event=auth_request_finished AND NOT success=yes) } metric imap_command { filter = event=imap_command_finished metric_group_by cmd_name { metric_group_by_method discrete { } } metric_group_by tagged_reply_state { metric_group_by_method discrete { } } } metric smtp_command { filter = event=smtp_server_command_finished and protocol=submission metric_group_by cmd_name { metric_group_by_method discrete { } } metric_group_by status_code { metric_group_by_method discrete { } } metric_group_by duration { metric_group_by_method exponential { base = 10 max_magnitude = 5 min_magnitude = 1 } } } metric lmtp_command { filter = event=smtp_server_command_finished and protocol=lmtp metric_group_by cmd_name { metric_group_by_method discrete { } } metric_group_by status_code { metric_group_by_method discrete { } } metric_group_by duration { metric_group_by_method exponential { base = 10 max_magnitude = 5 min_magnitude = 1 } } } metric mail_delivery { filter = event=mail_delivery_finished metric_group_by duration { metric_group_by_method exponential { base = 10 max_magnitude = 5 min_magnitude = 1 } } } event_exporter log { format = json time_format = rfc3339 } ssl_server { cert_file = /dovecot/albertocerts/fullchain.cer key_file = # hidden, use -P to show it key_password = # hidden, use -P to show it } protocol imap { mail_plugins { imap_sieve = yes imap_quota = yes last_login = yes } } protocol lmtp { mail_plugins { sieve = yes } } service managesieve-login { inet_listener sieve { port = 34190 } inet_listener sieve_deprecated { port = 2000 } } service managesieve { extra_groups = vmail } last_login { key = # hidden, use -P to show it precision = ms dict proxy { name = sql } } dict_server { dict sql { sql_driver = mysql mysql mimariadb { dbname = xxxxxxxx password = # hidden, use -P to show it user = xxxxxxx } } dict_map "shared/last-login/$service/$user/$remote_ip" { sql_table = last_login dict_map_value_field last_access { type = uint dict_map_key_field userid { value = $user } dict_map_key_field service { value = $service } dict_map_key_field last_ip { value = $remote_ip } } dict mysql { driver = sql sql_driver = mysql dict_map priv/quota/storage { sql_table = quotas username_field = username dict_map_value_field bytes { } } dict_map priv/quota/messages { sql_table = quotas username_field = username dict_map_value_field messages { } } } } quota "User quota" { driver = count quota_warning warn-espacio-95 { quota_storage_percentage = 95 execute quota-warning { args = espacio-95 %{user} } } quota_warning warn-mensajes-95 { quota_message_percentage = 95 execute quota-warning { args = cantidad-95 %{user} } } quota_warning warn-espacio-85 { quota_storage_percentage = 85 execute quota-warning { args = espacio-85 %{user} } } quota_warning warn-mensajes-85 { quota_message_percentage = 85 execute quota-warning { args = cantidad-85 %{user} } } quota_warning warn-espacio-75 { quota_storage_percentage = 75 execute quota-warning { args = espacio-75 %{user} } } quota_warning warn-mensajes-75 { quota_message_percentage = 75 execute quota-warning { args = cantidad-75 %{user} } } } service quota-warning { executable = script /dovecot/albertobin/quota-warning.sh user = vmail unix_listener quota-warning { group = vmail mode = 0660 user = vmail } } service quota-status { client_limit = 1 executable = quota-status -p postfix inet_listener postfix { port = 12340 } } sieve_script personal { active_path = ~/.dovecot.sieve driver = file path = ~/sieve } sieve_script default { driver = file name = default path = /etc/dovecot/sieve/default/ type = default } sieve_script after { path = /etc/dovecot/sieve-after type = after } sieve_script before { path = /etc/dovecot/sieve-before type = before }
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org