mirror of
https://github.com/mag37/dockcheck.git
synced 2026-03-05 16:40:30 +01:00
smtp-changes, deprecate ssmtp, suggest msmtp
This commit is contained in:
parent
de67cab998
commit
b1448fbb95
2 changed files with 29 additions and 4 deletions
|
|
@ -1,9 +1,22 @@
|
||||||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||||
|
# INFO: ssmtp is depcerated - consider to use msmtp instead.
|
||||||
#
|
#
|
||||||
# Copy/rename this file to notify.sh to enable email notifications on Synology DSM
|
# Copy/rename this file to notify.sh to enable the notification snipppet.
|
||||||
|
# mSMTP/sSMTP has to be installed and configured manually.
|
||||||
# The existing DSM Notification Email configuration will be used automatically.
|
# The existing DSM Notification Email configuration will be used automatically.
|
||||||
# Modify to your liking - changing SendMailTo and Subject and content.
|
# Modify to your liking - changing SendMailTo and Subject and content.
|
||||||
|
|
||||||
|
MSMTP=$(which msmtp)
|
||||||
|
SSMTP=$(which ssmtp)
|
||||||
|
|
||||||
|
if [ -n $MSMPT ] ; then
|
||||||
|
MAIL=$MSMTP
|
||||||
|
elif [ -n $SSMTP ] && [ -z $MAIL ] ; then
|
||||||
|
MAIL=$SSMTP
|
||||||
|
else
|
||||||
|
echo "No msmtp or ssmtp binary found in PATH: $PATH" ; exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
send_notification() {
|
send_notification() {
|
||||||
Updates=("$@")
|
Updates=("$@")
|
||||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||||
|
|
@ -23,7 +36,7 @@ SenderMail=${SenderMail:-$(grep 'eventmail1' $CfgFile | sed -n 's/.*"\([^"]*\)".
|
||||||
|
|
||||||
printf "\nSending email notification.\n"
|
printf "\nSending email notification.\n"
|
||||||
|
|
||||||
ssmtp $SendMailTo << __EOF
|
$MAIL $SendMailTo << __EOF
|
||||||
From: "$SenderName" <$SenderMail>
|
From: "$SenderName" <$SenderMail>
|
||||||
date:$(date -R)
|
date:$(date -R)
|
||||||
To: <$SendMailTo>
|
To: <$SendMailTo>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||||
|
# INFO: ssmtp is depcerated - consider to use msmtp instead.
|
||||||
#
|
#
|
||||||
# Copy/rename this file to notify.sh to enable the notification snipppet.
|
# Copy/rename this file to notify.sh to enable the notification snipppet.
|
||||||
# sSMTP has to be installed and configured manually.
|
# mSMTP/sSMTP has to be installed and configured manually.
|
||||||
# Modify to fit your setup - changing SendMailFrom, SendMailTo, SubjectTag
|
# Modify to fit your setup - changing SendMailFrom, SendMailTo, SubjectTag
|
||||||
|
|
||||||
|
MSMTP=$(which msmtp)
|
||||||
|
SSMTP=$(which ssmtp)
|
||||||
|
|
||||||
|
if [ -n $MSMPT ] ; then
|
||||||
|
MAIL=$MSMTP
|
||||||
|
elif [ -n $SSMTP ] && [ -z $MAIL ] ; then
|
||||||
|
MAIL=$SSMTP
|
||||||
|
else
|
||||||
|
echo "No msmtp or ssmtp binary found in PATH: $PATH" ; exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
send_notification() {
|
send_notification() {
|
||||||
Updates=("$@")
|
Updates=("$@")
|
||||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||||
|
|
@ -16,7 +28,7 @@ SubjectTag="dockcheck"
|
||||||
|
|
||||||
printf "\nSending email notification.\n"
|
printf "\nSending email notification.\n"
|
||||||
|
|
||||||
ssmtp $SendMailTo << __EOF
|
$MAIL $SendMailTo << __EOF
|
||||||
From: "$FromHost" <$SendMailFrom>
|
From: "$FromHost" <$SendMailFrom>
|
||||||
date:$(date -R)
|
date:$(date -R)
|
||||||
To: <$SendMailTo>
|
To: <$SendMailTo>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue