Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
2a8746f6
Unverified
Commit
2a8746f6
authored
Mar 08, 2020
by
Honza Hommer
Browse files
Feat: add msmtp command
parent
15b841da
Changes
1
Hide whitespace changes
Inline
Side-by-side
notify/mail.sh
View file @
2a8746f6
...
...
@@ -6,6 +6,7 @@
#MAIL_FROM="yyyy@gmail.com"
#MAIL_TO="yyyy@gmail.com"
#MAIL_NOVALIDATE=""
#MAIL_MSMTP_ACCOUNT=""
mail_send
()
{
_subject
=
"
$1
"
...
...
@@ -78,7 +79,7 @@ mail_send() {
_mail_bin
()
{
_MAIL_BIN
=
""
for
b
in
"
$MAIL_BIN
"
sendmail ssmtp mutt mail
;
do
for
b
in
"
$MAIL_BIN
"
sendmail ssmtp mutt mail
msmtp
;
do
if
_exists
"
$b
"
;
then
_MAIL_BIN
=
"
$b
"
break
...
...
@@ -86,7 +87,7 @@ _mail_bin() {
done
if
[
-z
"
$_MAIL_BIN
"
]
;
then
_err
"Please install sendmail, ssmtp, mutt or m
ail
first."
_err
"Please install sendmail, ssmtp, mutt
, mail
or m
smtp
first."
return
1
fi
...
...
@@ -105,8 +106,16 @@ _mail_cmnd() {
mutt
|
mail
)
_MAIL_ARGS
=
"-s '
$_subject
'"
;;
*
)
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
'"
...
...
@@ -114,7 +123,7 @@ _mail_cmnd() {
_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