mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-11-20 13:21:44 +00:00
Merge pull request #2779 from honzahommer/notify/mail.sh
Add msmtp command to notify/mail.sh
This commit is contained in:
commit
d083674fb1
@ -6,6 +6,7 @@
|
|||||||
#MAIL_FROM="yyyy@gmail.com"
|
#MAIL_FROM="yyyy@gmail.com"
|
||||||
#MAIL_TO="yyyy@gmail.com"
|
#MAIL_TO="yyyy@gmail.com"
|
||||||
#MAIL_NOVALIDATE=""
|
#MAIL_NOVALIDATE=""
|
||||||
|
#MAIL_MSMTP_ACCOUNT=""
|
||||||
|
|
||||||
mail_send() {
|
mail_send() {
|
||||||
_subject="$1"
|
_subject="$1"
|
||||||
@ -76,18 +77,17 @@ mail_send() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mail_bin() {
|
_mail_bin() {
|
||||||
if [ -n "$MAIL_BIN" ]; then
|
_MAIL_BIN=""
|
||||||
_MAIL_BIN="$MAIL_BIN"
|
|
||||||
elif _exists "sendmail"; then
|
for b in "$MAIL_BIN" sendmail ssmtp mutt mail msmtp; do
|
||||||
_MAIL_BIN="sendmail"
|
if _exists "$b"; then
|
||||||
elif _exists "ssmtp"; then
|
_MAIL_BIN="$b"
|
||||||
_MAIL_BIN="ssmtp"
|
break
|
||||||
elif _exists "mutt"; then
|
fi
|
||||||
_MAIL_BIN="mutt"
|
done
|
||||||
elif _exists "mail"; then
|
|
||||||
_MAIL_BIN="mail"
|
if [ -z "$_MAIL_BIN" ]; then
|
||||||
else
|
_err "Please install sendmail, ssmtp, mutt, mail or msmtp first."
|
||||||
_err "Please install sendmail, ssmtp, mutt or mail first."
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -95,30 +95,35 @@ _mail_bin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mail_cmnd() {
|
_mail_cmnd() {
|
||||||
|
_MAIL_ARGS=""
|
||||||
|
|
||||||
case $(basename "$_MAIL_BIN") in
|
case $(basename "$_MAIL_BIN") in
|
||||||
sendmail)
|
sendmail)
|
||||||
if [ -n "$MAIL_FROM" ]; then
|
if [ -n "$MAIL_FROM" ]; then
|
||||||
echo "'$_MAIL_BIN' -f '$MAIL_FROM' '$MAIL_TO'"
|
_MAIL_ARGS="-f '$MAIL_FROM'"
|
||||||
else
|
|
||||||
echo "'$_MAIL_BIN' '$MAIL_TO'"
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
ssmtp)
|
|
||||||
echo "'$_MAIL_BIN' '$MAIL_TO'"
|
|
||||||
;;
|
|
||||||
mutt | mail)
|
mutt | mail)
|
||||||
echo "'$_MAIL_BIN' -s '$_subject' '$MAIL_TO'"
|
_MAIL_ARGS="-s '$_subject'"
|
||||||
;;
|
;;
|
||||||
*)
|
msmtp)
|
||||||
_err "Command $MAIL_BIN is not supported, use sendmail, ssmtp, mutt or mail."
|
if [ -n "$MAIL_FROM" ]; then
|
||||||
return 1
|
_MAIL_ARGS="-f '$MAIL_FROM'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$MAIL_MSMTP_ACCOUNT" ]; then
|
||||||
|
_MAIL_ARGS="$_MAIL_ARGS -a '$MAIL_MSMTP_ACCOUNT'"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
|
*) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
echo "'$_MAIL_BIN' $_MAIL_ARGS '$MAIL_TO'"
|
||||||
}
|
}
|
||||||
|
|
||||||
_mail_body() {
|
_mail_body() {
|
||||||
case $(basename "$_MAIL_BIN") in
|
case $(basename "$_MAIL_BIN") in
|
||||||
sendmail | ssmtp)
|
sendmail | ssmtp | msmtp)
|
||||||
if [ -n "$MAIL_FROM" ]; then
|
if [ -n "$MAIL_FROM" ]; then
|
||||||
echo "From: $MAIL_FROM"
|
echo "From: $MAIL_FROM"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user