From 50bc28dc2aa41ef5c7daea9ff56fdab956180ca7 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sat, 20 Dec 2025 23:55:57 +0100 Subject: [PATCH] install_update_dovecot-2.4.sh: support english language in qota warn messages. --- conf/install_update_dovecot.conf.sample | 10 +++- install_update_dovecot-2.4.sh | 79 ++++++++++++++++++++++++- 2 files changed, 86 insertions(+), 3 deletions(-) diff --git a/conf/install_update_dovecot.conf.sample b/conf/install_update_dovecot.conf.sample index c2ed0f3..ef7064f 100644 --- a/conf/install_update_dovecot.conf.sample +++ b/conf/install_update_dovecot.conf.sample @@ -165,8 +165,16 @@ max_userip_connections=24 #auth_mechanisms="plain login digest-md5 cram-md5" auth_mechanisms="plain login" + +# --- # - Settings for quota warning sript -# - +# --- + +# msg_language +# +# possible Vallues are 'en' or 'de' +# +msg_language=de from_address="o.open " reply_to="oo@oopen.de" webmailer="https://webmail.oopen.de" diff --git a/install_update_dovecot-2.4.sh b/install_update_dovecot-2.4.sh index 670e337..81f75e4 100755 --- a/install_update_dovecot-2.4.sh +++ b/install_update_dovecot-2.4.sh @@ -1026,6 +1026,13 @@ if [[ "$database" != "postgres" ]] && [[ "$database" != "mysql" ]] ; then fi [[ -n "$dbpassword" ]] || fatal "Parameter "dbpassword" not set." +lang="${msg_language,,}" +if [[ "$lang" =~ ^(en|us|en_us)$ ]]; then + msg_language="en" +else + msg_language="de" +fi + [[ -n "$from_address" ]] || fatal ""Parameter "from_address" not set."" [[ -n "$reply_to" ]] || fatal ""Parameter "reply_to" not set."" [[ -n "$webmailer" ]] || fatal ""Parameter "webmailer" not set."" @@ -9912,7 +9919,47 @@ if [[ $dovecot_major_version -gt 2 ]] \ echononl " Create quota warning script.." ## - create the user-warning script ## - - cat </usr/local/bin/quota-warning.sh + if [[ "${msg_language}" == "en" ]] ; then + cat </usr/local/bin/quota-warning.sh +#!/usr/bin/env bash + +# author: zhang huangbin +# purpose: send mail to notify user when his mailbox quota exceeds a +# specified limit. +# project: iredmail (http://www.iredmail.org/) + +LANG=en_US.UTF-8 + +percent=\$1 +user=\$2 + +cat << EOF | /usr/local/dovecot/libexec/dovecot/dovecot-lda -d \${user} -o quota_enforce=no +Date: `date +"%a, %e %b %Y %H:%M:%S %z"` +From: $from_address +Reply-to: $reply_to +To:\${user} +Subject: Quota warning - mailbox is ${percent}% full +content-type: text/plain; + charset=utf-8 + +Hello! + +Your email inbox + \${user} +is over \${percent}% full. To continue receiving emails, please delete emails from your inbox on the server. + +You can also use the webmail service: + $webmailer + +After deleting emails, please remember to empty the trash folder as well. + +Best regards + +$salutation +${_EOF:-EOF} +EOF + else + cat </usr/local/bin/quota-warning.sh #!/usr/bin/env bash # author: zhang huangbin @@ -9951,6 +9998,7 @@ Viele Grüße $salutation ${_EOF:-EOF} EOF + fi if [ "$?" = 0 ]; then echo -e "$rc_done" else @@ -9963,7 +10011,33 @@ EOF echononl " Create quota warn-under script.." ## - create the user-warning script ## - - cat </usr/local/bin/quota-warn-under.sh + if [[ "${msg_language}" == "en" ]] ; then + cat </usr/local/bin/quota-warn-under.sh +cat << EOF | /usr/local/dovecot/libexec/dovecot/dovecot-lda -d \${user} -o quota_enforce=no +Date: \`date +"%a, %e %b %Y %H:%M:%S %z"\` +From: $from_address +Reply-to: $reply_to +To:\${user} +Subject: Mailbox quota: less than ${percent}% used +content-type: text/plain; + charset=utf-8 + +Your mailbox + \${user} +can now receive e-mail again. + +Please note that, depending on how much space you have freed, your available storage may fill up again quickly. + +You can check the current usage in your mail client or via the webmailer here: + $webmailer + +Best regards + +$salutation +${_EOF:-EOF} +EOF + else + cat </usr/local/bin/quota-warn-under.sh #!/usr/bin/env bash percent=\$1 @@ -9995,6 +10069,7 @@ Viele Grüße $salutation ${_EOF:-EOF} EOF + fi if [ "$?" = 0 ]; then echo -e "$rc_done" else