mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-05-14 22:54:12 +00:00
fix: expose _MAIL_BIN variable
This commit is contained in:
parent
2adeed885e
commit
bbd45c826c
@ -27,7 +27,8 @@ mail_send() {
|
|||||||
_err "It seems that the command $MAIL_BIN is not in path."
|
_err "It seems that the command $MAIL_BIN is not in path."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
_MAIL_CMD=$(_mail_cmnd)
|
_MAIL_BIN=$(_mail_bin)
|
||||||
|
_MAIL_CMND=$(_mail_cmnd)
|
||||||
if [ -n "$MAIL_BIN" ]; then
|
if [ -n "$MAIL_BIN" ]; then
|
||||||
_saveaccountconf_mutable MAIL_BIN "$MAIL_BIN"
|
_saveaccountconf_mutable MAIL_BIN "$MAIL_BIN"
|
||||||
else
|
else
|
||||||
@ -63,8 +64,9 @@ mail_send() {
|
|||||||
|
|
||||||
contenttype="text/plain; charset=utf-8"
|
contenttype="text/plain; charset=utf-8"
|
||||||
subject="=?UTF-8?B?$(echo "$_subject" | _base64)?="
|
subject="=?UTF-8?B?$(echo "$_subject" | _base64)?="
|
||||||
result=$({ echo "$_MAIL_BODY" | eval "$_MAIL_CMD"; } 2>&1)
|
result=$({ echo "$_MAIL_BODY" | eval "$_MAIL_CMND"; } 2>&1)
|
||||||
|
|
||||||
|
# shellcheck disable=SC2181
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
_debug "mail send error."
|
_debug "mail send error."
|
||||||
_err "$result"
|
_err "$result"
|
||||||
@ -75,7 +77,7 @@ mail_send() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
_mail_cmnd() {
|
_mail_bin() {
|
||||||
if [ -n "$MAIL_BIN" ]; then
|
if [ -n "$MAIL_BIN" ]; then
|
||||||
_MAIL_BIN="$MAIL_BIN"
|
_MAIL_BIN="$MAIL_BIN"
|
||||||
elif _exists "sendmail"; then
|
elif _exists "sendmail"; then
|
||||||
@ -91,6 +93,10 @@ _mail_cmnd() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "$_MAIL_BIN"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mail_cmnd() {
|
||||||
case $(basename "$_MAIL_BIN") in
|
case $(basename "$_MAIL_BIN") in
|
||||||
sendmail)
|
sendmail)
|
||||||
if [ -n "$MAIL_FROM" ]; then
|
if [ -n "$MAIL_FROM" ]; then
|
||||||
@ -113,16 +119,18 @@ _mail_cmnd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mail_body() {
|
_mail_body() {
|
||||||
if [ "$_MAIL_BIN" = "sendmail" ] || [ "$_MAIL_BIN" = "ssmtp" ]; then
|
case $(basename "$_MAIL_BIN") in
|
||||||
if [ -n "$MAIL_FROM" ]; then
|
sendmail | ssmtp)
|
||||||
echo "From: $MAIL_FROM"
|
if [ -n "$MAIL_FROM" ]; then
|
||||||
fi
|
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"
|
||||||
echo
|
echo
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
echo "$_content"
|
echo "$_content"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user