mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-11-17 20:01:46 +00:00
make MAIL_FROM not required
This commit is contained in:
parent
d180f01b45
commit
d509ef7581
@ -27,11 +27,14 @@ mail_send() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
MAIL_FROM="${MAIL_FROM:-$(_readaccountconf_mutable MAIL_FROM)}"
|
MAIL_FROM="${MAIL_FROM:-$(_readaccountconf_mutable MAIL_FROM)}"
|
||||||
if [ -z "$MAIL_FROM" ]; then
|
if [ -n "$MAIL_FROM" ]; then
|
||||||
MAIL_FROM="$USER@$(hostname -f)"
|
if ! _contains "$MAIL_FROM" "@"; then
|
||||||
_info "The MAIL_FROM is not set, so use the default value: $MAIL_FROM"
|
_err "It seems that the MAIL_FROM=$MAIL_FROM is not a valid email address."
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_saveaccountconf_mutable MAIL_FROM "$MAIL_FROM"
|
_saveaccountconf_mutable MAIL_FROM "$MAIL_FROM"
|
||||||
|
fi
|
||||||
|
|
||||||
MAIL_TO="${MAIL_TO:-$(_readaccountconf_mutable MAIL_TO)}"
|
MAIL_TO="${MAIL_TO:-$(_readaccountconf_mutable MAIL_TO)}"
|
||||||
if [ -z "$MAIL_TO" ]; then
|
if [ -z "$MAIL_TO" ]; then
|
||||||
@ -57,7 +60,11 @@ mail_send() {
|
|||||||
_mail_send() {
|
_mail_send() {
|
||||||
case "$_MAIL_BIN" in
|
case "$_MAIL_BIN" in
|
||||||
sendmail)
|
sendmail)
|
||||||
|
if [ -n "$MAIL_FROM" ]; then
|
||||||
"$_MAIL_BIN" -f "$MAIL_FROM" "$MAIL_TO"
|
"$_MAIL_BIN" -f "$MAIL_FROM" "$MAIL_TO"
|
||||||
|
else
|
||||||
|
"$_MAIL_BIN" "$MAIL_TO"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
ssmtp)
|
ssmtp)
|
||||||
"$_MAIL_BIN" "$MAIL_TO"
|
"$_MAIL_BIN" "$MAIL_TO"
|
||||||
@ -70,7 +77,10 @@ _mail_send() {
|
|||||||
|
|
||||||
_mail_body() {
|
_mail_body() {
|
||||||
if [ "$_MAIL_BIN" = "sendmail" ] || [ "$_MAIL_BIN" = "ssmtp" ]; then
|
if [ "$_MAIL_BIN" = "sendmail" ] || [ "$_MAIL_BIN" = "ssmtp" ]; then
|
||||||
|
if [ -n "$MAIL_FROM" ]; then
|
||||||
echo "From: $MAIL_FROM"
|
echo "From: $MAIL_FROM"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "To: $MAIL_TO"
|
echo "To: $MAIL_TO"
|
||||||
echo "Subject: $subject"
|
echo "Subject: $subject"
|
||||||
echo "Content-Type: $contenttype"
|
echo "Content-Type: $contenttype"
|
||||||
|
Loading…
Reference in New Issue
Block a user