Skip to content

Commit cab9071

Browse files
authored
Introduce Apprise Email
Add Apprise email service to send emails without using mailx.
1 parent 38536ab commit cab9071

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

snapraid-aio-script.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
######################
99
# SCRIPT VARIABLES #
1010
######################
11-
SNAPSCRIPTVERSION="3.4" #DEV10
11+
SNAPSCRIPTVERSION="3.4" #DEV11
1212

1313
# Read SnapRAID version
1414
SNAPRAIDVERSION="$(snapraid -V | sed -e 's/snapraid v\(.*\)by.*/\1/')"
@@ -399,7 +399,7 @@ fi
399399
echo "## Total time elapsed for SnapRAID: $ELAPSED"
400400
mklog "INFO: Total time elapsed for SnapRAID: $ELAPSED"
401401
# if email or hook service are enabled, will be sent now
402-
if [ "$EMAIL_ADDRESS" ] || [ -x "$HOOK_NOTIFICATION" ] || [ "$HEALTHCHECKS" -eq 1 ] || [ "$TELEGRAM" -eq 1 ] || [ "$DISCORD" -eq 1 ]; then
402+
if [ "$EMAIL_ADDRESS" ] || [ -x "$HOOK_NOTIFICATION" ] || [ "$APPRISE_EMAIL" -eq 1 ] || [ "$HEALTHCHECKS" -eq 1 ] || [ "$TELEGRAM" -eq 1 ] || [ "$DISCORD" -eq 1 ]; then
403403
# Add a topline to email body and send a long mail
404404
sed_me "1s:^:##$SUBJECT \n:" "${TMP_OUTPUT}"
405405
# send long mail if verbosity is set to 1
@@ -1024,6 +1024,9 @@ function send_mail(){
10241024
if [ -x "$HOOK_NOTIFICATION" ]; then
10251025
echo -e "Notification user script is set. Calling it now [$(date)]"
10261026
$HOOK_NOTIFICATION "$SUBJECT" "$body"
1027+
elif [ "$APPRISE_EMAIL" -eq 1 ]; then
1028+
echo "Sending email report using Apprise service."
1029+
"$APPRISE_BIN" -vv -i "html" -t "$SUBJECT" -b "$body" \ "$APPRISE_EMAIL_URL"
10271030
elif [ "$EMAIL_ADDRESS" ]; then
10281031
echo -e "Email address is set. Sending email report to **$EMAIL_ADDRESS** [$(date)]"
10291032
if [ -z "$MAIL_BIN" ]; then
@@ -1050,8 +1053,8 @@ elif [ "$EMAIL_ADDRESS" ]; then
10501053
$MAIL_BIN -a 'Content-Type: text/html; charset=UTF-8' -s "$SUBJECT" -r "$FROM_EMAIL_ADDRESS" "$EMAIL_ADDRESS" \
10511054
< <(echo "$body")
10521055
fi
1053-
fi
1054-
fi
1056+
fi
1057+
fi
10551058
fi
10561059

10571060
}

0 commit comments

Comments
 (0)