From 84f41e944ab82028d6253e2eccc1458842e5948a Mon Sep 17 00:00:00 2001 From: Christoph Date: Mon, 28 Sep 2020 16:08:42 +0200 Subject: [PATCH] Finish support of (utf-8) encoded subject - now forgot file logrotate_handle-backups.conf.sample. --- conf/logrotate_handle-backups.conf.sample | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/conf/logrotate_handle-backups.conf.sample b/conf/logrotate_handle-backups.conf.sample index 7be32b9..3e5c276 100644 --- a/conf/logrotate_handle-backups.conf.sample +++ b/conf/logrotate_handle-backups.conf.sample @@ -30,11 +30,15 @@ send=`cat $logFile` - datum=`date +"%d.%m.%Y"` + datum="$(date +"%d.%m.%Y")" - echo -e "To:${admin_email}\n${content_type}\nSubject:Handle Backups $company -- $datum\n$filesystem\n\nBackup resource / Label: $label\n$durations\n\n$send\n" | /usr/sbin/sendmail -F "BACKUP $company" -f $from_address $admin_email + subject="Backup $company -- $datum" + subject_utf8="$(echo "$subject" | iconv -t UTF8)" + subject_utf8_encoded="=?utf-8?B?$(echo $subject_utf8 | base64 --wrap=0)?=" + + echo -e "To:${admin_email}\n${content_type}\nSubject:${subject_utf8_encoded}\n$filesystem\n\nBackup resource / Label: $label\n$durations\n\n$send\n" | /usr/sbin/sendmail -F "BACKUP $company" -f $from_address $admin_email if [[ -n "$extra_admin_email" ]]; then - echo -e "To:${extra_admin_email}\n${content_type}\nSubject:Handle Backups $company -- $datum\n$filesystem\n\nBackup resource / Labe: $label\n$durations\n\n$send\n" | /usr/sbin/sendmail -F "BACKUP $company" -f $from_address $extra_admin_email + echo -e "To:${extra_admin_email}\n${content_type}\nSubject:${subject_utf8_encoded}\n$filesystem\n\nBackup resource / Labe: $label\n$durations\n\n$send\n" | /usr/sbin/sendmail -F "BACKUP $company" -f $from_address $extra_admin_email fi declare -i error=`grep -e"\[ERROR" $logFile | wc -l` @@ -51,9 +55,13 @@ msg="${msg_top}\n${msg_body_01}\n${msg_body_02}" - echo -e "To:${admin_email}\n${content_type}\nSubject:Handle Backups Errors $company -- $datum\n${msg}" | /usr/sbin/sendmail -F "Errors BACKUP $company" -f $from_address $admin_email + subject="Subject:Handle Backups Errors $company -- $datum" + subject_utf8="$(echo "$subject" | iconv -t UTF8)" + subject_utf8_encoded="=?utf-8?B?$(echo $subject_utf8 | base64 --wrap=0)?=" + + echo -e "To:${admin_email}\n${content_type}\nSubject:${subject_utf8_encoded}\n${msg}" | /usr/sbin/sendmail -F "Errors BACKUP $company" -f $from_address $admin_email if [ "X$extra_error_email" != "X" ]; then - echo -e "To:${extra_error_email}\n${content_type}\nSubject:Handle Backups Errors $company -- $datum\n${msg}" | /usr/sbin/sendmail -F "Errors BACKUP $company" -f $from_address $extra_error_email + echo -e "To:${extra_error_email}\n${content_type}\nSubject:${subject_utf8_encoded}\n${msg}" | /usr/sbin/sendmail -F "Errors BACKUP $company" -f $from_address $extra_error_email fi fi