Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
d083674f
Unverified
Commit
d083674f
authored
Apr 18, 2020
by
neil
Committed by
GitHub
Apr 18, 2020
Browse files
Merge pull request #2779 from honzahommer/notify/mail.sh
Add msmtp command to notify/mail.sh
parents
ed7a9452
2a8746f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
notify/mail.sh
View file @
d083674f
...
...
@@ -6,6 +6,7 @@
#MAIL_FROM="yyyy@gmail.com"
#MAIL_TO="yyyy@gmail.com"
#MAIL_NOVALIDATE=""
#MAIL_MSMTP_ACCOUNT=""
mail_send
()
{
_subject
=
"
$1
"
...
...
@@ -76,18 +77,17 @@ mail_send() {
}
_mail_bin
()
{
if
[
-n
"
$MAIL_BIN
"
]
;
then
_MAIL_BIN
=
"
$MAIL_BIN
"
elif
_exists
"sendmail"
;
then
_MAIL_BIN
=
"sendmail"
elif
_exists
"ssmtp"
;
then
_MAIL_BIN
=
"ssmtp"
elif
_exists
"mutt"
;
then
_MAIL_BIN
=
"mutt"
elif
_exists
"mail"
;
then
_MAIL_BIN
=
"mail"
else
_err
"Please install sendmail, ssmtp, mutt or mail first."
_MAIL_BIN
=
""
for
b
in
"
$MAIL_BIN
"
sendmail ssmtp mutt mail msmtp
;
do
if
_exists
"
$b
"
;
then
_MAIL_BIN
=
"
$b
"
break
fi
done
if
[
-z
"
$_MAIL_BIN
"
]
;
then
_err
"Please install sendmail, ssmtp, mutt, mail or msmtp first."
return
1
fi
...
...
@@ -95,30 +95,35 @@ _mail_bin() {
}
_mail_cmnd
()
{
_MAIL_ARGS
=
""
case
$(
basename
"
$_MAIL_BIN
"
)
in
sendmail
)
if
[
-n
"
$MAIL_FROM
"
]
;
then
echo
"'
$_MAIL_BIN
' -f '
$MAIL_FROM
' '
$MAIL_TO
'"
else
echo
"'
$_MAIL_BIN
' '
$MAIL_TO
'"
_MAIL_ARGS
=
"-f '
$MAIL_FROM
'"
fi
;;
ssmtp
)
echo
"'
$_MAIL_BIN
' '
$MAIL_TO
'"
;;
mutt
|
mail
)
echo
"'
$_MAIL_BIN
'
-s '
$_subject
'
'
$MAIL_TO
'
"
_MAIL_ARGS
=
"
-s '
$_subject
'"
;;
*
)
_err
"Command
$MAIL_BIN
is not supported, use sendmail, ssmtp, mutt or mail."
return
1
msmtp
)
if
[
-n
"
$MAIL_FROM
"
]
;
then
_MAIL_ARGS
=
"-f '
$MAIL_FROM
'"
fi
if
[
-n
"
$MAIL_MSMTP_ACCOUNT
"
]
;
then
_MAIL_ARGS
=
"
$_MAIL_ARGS
-a '
$MAIL_MSMTP_ACCOUNT
'"
fi
;;
*
)
;;
esac
echo
"'
$_MAIL_BIN
'
$_MAIL_ARGS
'
$MAIL_TO
'"
}
_mail_body
()
{
case
$(
basename
"
$_MAIL_BIN
"
)
in
sendmail
|
ssmtp
)
sendmail
|
ssmtp
|
msmtp
)
if
[
-n
"
$MAIL_FROM
"
]
;
then
echo
"From:
$MAIL_FROM
"
fi
...
...
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