plugin {
    # debug quota using `doveadm quota get -u user@domain`
    # recompute quota using `doveadm quota recalc -u user@domain`

    # Track the current quota usage in Dovecot’s index files.
    quota = count:User quota

    # Use virtual sizes for count
    quota_vsizes = yes

    # define the maximum message size to be saved, sync with postfix
    quota_max_mail_size = 10000M

    # default quota per mailbox, sync with postfix
    quota_rule = *:storage=128M

    # allow user to delete messages
    quota_rule2 = Trash:storage=+50M

    quota_grace = 10%%
    # 10% is the default
    quota_warning = storage=95%% quota-warning 95 %u %d
    quota_warning2 = storage=80%% quota-warning 80 %u %d
    quota_warning3 = -storage=100%% quota-warning below %u %d # user is no longer over quota


    quota_status_success=DUNNO
    quota_status_nouser=DUNNO
    quota_status_overquota = "552 5.2.2 Mailbox is full"
}

service quota-warning {
    executable = script /usr/local/bin/quota-warning.sh
    unix_listener quota-warning {
        user = dovecot
        group = dovecot
        mode = 0660
    }
}

# allow postfix to query quota
service quota-status {
    executable = quota-status -p postfix
    inet_listener {
    port = 65265
    # You can choose any port you want
    }
    client_limit = 1
}