summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2020-06-26 09:06:25 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2020-06-26 09:06:25 (GMT)
commit865e66a4b1a536b024a1db7431ded7a24a84e598 (patch) (side-by-side diff)
treeed9352e5b28adb03fe8f57ff9d14cd99efff1f18
parent66f06e2daeb2952a5dba017f03606b48c3ce4dec (diff)
downloadbeam-865e66a4b1a536b024a1db7431ded7a24a84e598.tar.gz
beam-865e66a4b1a536b024a1db7431ded7a24a84e598.tar.bz2
Fix formatting of mail headersHEADmaster
* lib/beam/common.in (construct_mail_header): New function. (mail_report): Build mail headers using construct_mail_header.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--lib/beam/common.in27
1 files changed, 22 insertions, 5 deletions
diff --git a/lib/beam/common.in b/lib/beam/common.in
index e8389f9..4d6442f 100644
--- a/lib/beam/common.in
+++ b/lib/beam/common.in
@@ -197,6 +197,19 @@ dry_mail() {
echo "============================================================="
}
+# construct_mail_header NAME VALUE
+construct_mail_header() {
+ local name value
+ name=$(echo "mail_header_$1"|tr 'A-Z' 'a-z'|tr '-' '_')
+ value=$(echo "$1: $2" |\
+ tr '\n' ' ' |\
+ tr '\t' ' ' |\
+ tr -s ' ' |\
+ fmt -w64 -s |\
+ sed -e '2,$s/^/ /')
+ eval $name='$value'
+}
+
# mail_report FILE
mail_report() {
: ${backup_mailer_program:=/usr/sbin/sendmail -oi -t -F $backup_sender_email}
@@ -223,11 +236,15 @@ mail_report() {
fi
test -n "$backup_report_signature" &&
echo "$backup_report_signature" >> $report
- (cat - <<EOF
-From: ${backup_sender_personal}$backup_sender_email
-To: $backup_notify_email
-Subject: $backup_report_subject
-X-Beam-Items: $backup_items
+ (construct_mail_header From "${backup_sender_personal}$backup_sender_email"
+ construct_mail_header To "$backup_notify_email"
+ construct_mail_header Subject "$backup_report_subject"
+ construct_mail_header X-Beam-Items "$backup_items"
+ cat - <<EOF
+$mail_header_from
+$mail_header_to
+$mail_header_subject
+$mail_header_x_beam_items
X-Beam-Round: $round
X-Beam-Level: $level
EOF

Return to:

Send suggestions and report system problems to the System administrator.