mirror of
https://github.com/deajan/obackup.git
synced 2024-12-26 07:23:41 +01:00
Basic sendemail busybox implementation
This commit is contained in:
parent
04524e6bec
commit
f2a62821d6
@ -1,6 +1,6 @@
|
|||||||
#### MINIMAL-FUNCTION-SET BEGIN ####
|
#### MINIMAL-FUNCTION-SET BEGIN ####
|
||||||
|
|
||||||
## FUNC_BUILD=2016102307
|
## FUNC_BUILD=2016102308
|
||||||
## BEGIN Generic bash functions written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## BEGIN Generic bash functions written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||||
|
|
||||||
## To use in a program, define the following variables:
|
## To use in a program, define the following variables:
|
||||||
@ -301,6 +301,20 @@ function SendAlert {
|
|||||||
if [ "$mail_no_attachment" -eq 0 ]; then
|
if [ "$mail_no_attachment" -eq 0 ]; then
|
||||||
attachment_command="-a $ALERT_LOG_FILE"
|
attachment_command="-a $ALERT_LOG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "LOCAL_OS" == "BUSYBOX" ]; then
|
||||||
|
if type sendmail > /dev/null 2>&1; then
|
||||||
|
echo "$body" | $(type -p sendmail) -f "$SENDER_EMAIL" -S "$SMTP_SERVER:$SMTP_PORT" -au "$SMTP_USER" -ap "$SMTP_PASS"
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
Logger "Cannot send alert mail via ($type -p sendmail) !!! "WARN"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
Logger "Sendmail not present. Won't send any mail" "WARN"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if type mutt > /dev/null 2>&1 ; then
|
if type mutt > /dev/null 2>&1 ; then
|
||||||
echo "$body" | $(type -p mutt) -x -s "$subject" $DESTINATION_MAILS $attachment_command
|
echo "$body" | $(type -p mutt) -x -s "$subject" $DESTINATION_MAILS $attachment_command
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user