Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
b36247a0
Commit
b36247a0
authored
Feb 16, 2021
by
medmunds
Browse files
Implement _rfc2822_date helper
parent
6e77756d
Changes
1
Hide whitespace changes
Inline
Side-by-side
notify/smtp.sh
View file @
b36247a0
...
@@ -224,9 +224,7 @@ _smtp_raw_message() {
...
@@ -224,9 +224,7 @@ _smtp_raw_message() {
echo
"From:
$SMTP_FROM
"
echo
"From:
$SMTP_FROM
"
echo
"To:
$SMTP_TO
"
echo
"To:
$SMTP_TO
"
echo
"Subject:
$(
_mime_encoded_word
"
$SMTP_SUBJECT
"
)
"
echo
"Subject:
$(
_mime_encoded_word
"
$SMTP_SUBJECT
"
)
"
if
_exists
date
;
then
echo
"Date:
$(
_rfc2822_date
)
"
echo
"Date:
$(
date
+
'%a, %-d %b %Y %H:%M:%S %z'
)
"
fi
echo
"Content-Type: text/plain; charset=utf-8"
echo
"Content-Type: text/plain; charset=utf-8"
echo
"X-Mailer:
$SMTP_X_MAILER
"
echo
"X-Mailer:
$SMTP_X_MAILER
"
echo
echo
...
@@ -248,6 +246,19 @@ _mime_encoded_word() {
...
@@ -248,6 +246,19 @@ _mime_encoded_word() {
fi
fi
}
}
# Output current date in RFC-2822 Section 3.3 format as required in email headers
# (e.g., "Mon, 15 Feb 2021 14:22:01 -0800")
_rfc2822_date
()
{
# Notes:
# - this is deliberately not UTC, because it "SHOULD express local time" per spec
# - the spec requires weekday and month in the C locale (English), not localized
# - this date format specifier has been tested on Linux, Mac, Solaris and FreeBSD
_old_lc_time
=
"
$LC_TIME
"
LC_TIME
=
C
date
+
'%a, %-d %b %Y %H:%M:%S %z'
LC_TIME
=
"
$_old_lc_time
"
}
# Simple check for display name in an email address (< > or ")
# Simple check for display name in an email address (< > or ")
# email
# email
_email_has_display_name
()
{
_email_has_display_name
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment