mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-05-14 19:52:45 +00:00
feat: disable e-mail validation if MAIL_NOVALIDATE is set
This commit is contained in:
parent
2aa219e150
commit
2adeed885e
@ -5,6 +5,7 @@
|
||||
#MAIL_BIN="sendmail"
|
||||
#MAIL_FROM="yyyy@gmail.com"
|
||||
#MAIL_TO="yyyy@gmail.com"
|
||||
#MAIL_NOVALIDATE=""
|
||||
|
||||
mail_send() {
|
||||
_subject="$1"
|
||||
@ -14,6 +15,13 @@ mail_send() {
|
||||
_debug "_content" "$_content"
|
||||
_debug "_statusCode" "$_statusCode"
|
||||
|
||||
MAIL_NOVALIDATE="${MAIL_NOVALIDATE:-$(_readaccountconf_mutable MAIL_NOVALIDATE)}"
|
||||
if [ -n "$MAIL_NOVALIDATE" ]; then
|
||||
_saveaccountconf_mutable MAIL_NOVALIDATE 1
|
||||
else
|
||||
_clearaccountconf "MAIL_NOVALIDATE"
|
||||
fi
|
||||
|
||||
MAIL_BIN="${MAIL_BIN:-$(_readaccountconf_mutable MAIL_BIN)}"
|
||||
if [ -n "$MAIL_BIN" ] && ! _exists "$MAIL_BIN"; then
|
||||
_err "It seems that the command $MAIL_BIN is not in path."
|
||||
@ -29,7 +37,7 @@ mail_send() {
|
||||
|
||||
MAIL_FROM="${MAIL_FROM:-$(_readaccountconf_mutable MAIL_FROM)}"
|
||||
if [ -n "$MAIL_FROM" ]; then
|
||||
if ! _contains "$MAIL_FROM" "@"; then
|
||||
if ! _mail_valid "$MAIL_FROM"; then
|
||||
_err "It seems that the MAIL_FROM=$MAIL_FROM is not a valid email address."
|
||||
return 1
|
||||
fi
|
||||
@ -39,7 +47,7 @@ mail_send() {
|
||||
|
||||
MAIL_TO="${MAIL_TO:-$(_readaccountconf_mutable MAIL_TO)}"
|
||||
if [ -n "$MAIL_TO" ]; then
|
||||
if ! _contains "$MAIL_TO" "@"; then
|
||||
if ! _mail_valid "$MAIL_TO"; then
|
||||
_err "It seems that the MAIL_TO=$MAIL_TO is not a valid email address."
|
||||
return 1
|
||||
fi
|
||||
@ -118,3 +126,7 @@ _mail_body() {
|
||||
|
||||
echo "$_content"
|
||||
}
|
||||
|
||||
_mail_valid() {
|
||||
[ -n "$MAIL_NOVALIDATE" ] || _contains "$1" "@"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user