install_update_dovecot-2.4.sh: support english language in qota warn messages.

This commit is contained in:
2025-12-20 23:55:57 +01:00
parent b87793cbad
commit 50bc28dc2a
2 changed files with 86 additions and 3 deletions

View File

@@ -165,8 +165,16 @@ max_userip_connections=24
#auth_mechanisms="plain login digest-md5 cram-md5" #auth_mechanisms="plain login digest-md5 cram-md5"
auth_mechanisms="plain login" auth_mechanisms="plain login"
# ---
# - Settings for quota warning sript # - Settings for quota warning sript
# - # ---
# msg_language
#
# possible Vallues are 'en' or 'de'
#
msg_language=de
from_address="o.open <oo@oopen.de>" from_address="o.open <oo@oopen.de>"
reply_to="oo@oopen.de" reply_to="oo@oopen.de"
webmailer="https://webmail.oopen.de" webmailer="https://webmail.oopen.de"

View File

@@ -1026,6 +1026,13 @@ if [[ "$database" != "postgres" ]] && [[ "$database" != "mysql" ]] ; then
fi fi
[[ -n "$dbpassword" ]] || fatal "Parameter "dbpassword" not set." [[ -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 "$from_address" ]] || fatal ""Parameter "from_address" not set.""
[[ -n "$reply_to" ]] || fatal ""Parameter "reply_to" not set."" [[ -n "$reply_to" ]] || fatal ""Parameter "reply_to" not set.""
[[ -n "$webmailer" ]] || fatal ""Parameter "webmailer" not set."" [[ -n "$webmailer" ]] || fatal ""Parameter "webmailer" not set.""
@@ -9912,7 +9919,47 @@ if [[ $dovecot_major_version -gt 2 ]] \
echononl " Create quota warning script.." echononl " Create quota warning script.."
## - create the user-warning script ## - create the user-warning script
## - ## -
cat <<EOF >/usr/local/bin/quota-warning.sh if [[ "${msg_language}" == "en" ]] ; then
cat <<EOF >/usr/local/bin/quota-warning.sh
#!/usr/bin/env bash
# author: zhang huangbin <michaelbibby (at) gmail.com>
# 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 <<EOF >/usr/local/bin/quota-warning.sh
#!/usr/bin/env bash #!/usr/bin/env bash
# author: zhang huangbin <michaelbibby (at) gmail.com> # author: zhang huangbin <michaelbibby (at) gmail.com>
@@ -9951,6 +9998,7 @@ Viele Grüße
$salutation $salutation
${_EOF:-EOF} ${_EOF:-EOF}
EOF EOF
fi
if [ "$?" = 0 ]; then if [ "$?" = 0 ]; then
echo -e "$rc_done" echo -e "$rc_done"
else else
@@ -9963,7 +10011,33 @@ EOF
echononl " Create quota warn-under script.." echononl " Create quota warn-under script.."
## - create the user-warning script ## - create the user-warning script
## - ## -
cat <<EOF >/usr/local/bin/quota-warn-under.sh if [[ "${msg_language}" == "en" ]] ; then
cat <<EOF >/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 <<EOF >/usr/local/bin/quota-warn-under.sh
#!/usr/bin/env bash #!/usr/bin/env bash
percent=\$1 percent=\$1
@@ -9995,6 +10069,7 @@ Viele Grüße
$salutation $salutation
${_EOF:-EOF} ${_EOF:-EOF}
EOF EOF
fi
if [ "$?" = 0 ]; then if [ "$?" = 0 ]; then
echo -e "$rc_done" echo -e "$rc_done"
else else