|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
#### MINIMAL-FUNCTION-SET BEGIN ####
|
|
|
|
|
|
|
|
|
|
## FUNC_BUILD=2016111901
|
|
|
|
|
## FUNC_BUILD=2016112101
|
|
|
|
|
## 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:
|
|
|
|
@ -410,13 +410,18 @@ function SendEmail {
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if type mail > /dev/null 2>&1 ; then
|
|
|
|
|
if [ "$mail_no_attachment" -eq 0 ] && $(type -p mail) -V | grep "GNU" > /dev/null; then
|
|
|
|
|
# We need to detect which version of mail is installed
|
|
|
|
|
if ! $(type -p mail) -V > /dev/null 2>&1; then
|
|
|
|
|
# This may be MacOS mail program
|
|
|
|
|
attachment_command=""
|
|
|
|
|
elif [ "$mail_no_attachment" -eq 0 ] && $(type -p mail) -V | grep "GNU" > /dev/null; then
|
|
|
|
|
attachment_command="-A $attachment"
|
|
|
|
|
elif [ "$mail_no_attachment" -eq 0 ] && $(type -p mail) -V > /dev/null; then
|
|
|
|
|
attachment_command="-a$attachment"
|
|
|
|
|
else
|
|
|
|
|
attachment_command=""
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "$message" | $(type -p mail) $attachment_command -s "$subject" "$destinationMails"
|
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
|
Logger "Cannot send mail via $(type -p mail) with attachments !!!" "WARN"
|
|
|
|
|