Add quota-warning script and config

This commit is contained in:
Tunui Franken 2024-01-09 19:25:44 +01:00
parent 56bb12f2c6
commit 0214544027
3 changed files with 34 additions and 0 deletions

View file

@ -127,6 +127,13 @@
line: '\1mail_plugins = $mail_plugins sieve' line: '\1mail_plugins = $mail_plugins sieve'
notify: Reload dovecot service notify: Reload dovecot service
- name: Copy quota-warning script
become: true
ansible.builtin.template:
src: quota-warning.sh.j2
dest: /usr/local/bin/quota-warning.sh
mode: "755"
- name: Copy 90-quota.conf - name: Copy 90-quota.conf
become: true become: true
ansible.builtin.template: ansible.builtin.template:

View file

@ -15,3 +15,17 @@ service quota-status {
user = postfix user = postfix
} }
} }
plugin {
quota_warning = storage=95%% quota-warning 95 %u
quota_warning2 = storage=80%% quota-warning 80 %u
}
service quota-warning {
executable = script /usr/local/bin/quota-warning.sh
unix_listener quota-warning {
user = vmail
group = vmail
mode = 0660
}
}

View file

@ -0,0 +1,13 @@
#!/bin/sh
PERCENT=$1
USER=$2
cat << EOF | /usr/lib/dovecot/dovecot-lda -d "$USER" -o "plugin/quota=maildir:User quota:noenforcing"
From: postmaster@{{ ansible_hostname }}.tunuifranken.info
Subject: Quota warning - $PERCENT% reached
Your mailbox can only store a limited amount of emails.
Currently it is $PERCENT% full. If you reach 100% then
new emails cannot be stored. Thanks for your understanding.
EOF