Updated check_updates_dev.sh to use Office 365 SMTP

This commit is contained in:
Matthew McKinnon 2017-03-14 19:23:02 +10:00
parent 8b7e664b66
commit 7cad27295b
2 changed files with 8 additions and 4 deletions

1
.gitignore vendored Executable file
View File

@ -0,0 +1 @@
office365.conf

View File

@ -15,9 +15,11 @@
# Make user configuration changes in this section # Make user configuration changes in this section
# #
MAILTO="support@comprofix.com" MAIL="support@comprofix.com"
SMTP=mail.comprofix.com O365_SMTP=$(grep SMTP office365.conf | awk -F'=' '{print $2}')
MAILFROM="$(hostname)@$(dnsdomainname)" O365_USER=$(grep USER office365.conf | awk -F'=' '{print $2}')
O365_PASS=$(grep PASS office365.conf | awk -F'=' '{print $2}')
AUTOUPDATE="no" AUTOUPDATE="no"
LOGFILE="/var/log/server_maint.log" LOGFILE="/var/log/server_maint.log"
@ -142,7 +144,8 @@ See the logfile for more info: vim $LOGFILE
Regards. " >/tmp/servermail.msg Regards. " >/tmp/servermail.msg
sendemail -o tls=no -s $SMTP -t $MAILTO -f "$THISSERVER <$MAILFROM>" -u "[$THISSERVER] server may need some updates applied" -m "$(cat /tmp/servermail.msg)" sendemail -o tls=auto -s "$O365_SMTP" -xu "$O365_USER" -xp "$O365_PASS" -t "$MAIL" -f "$MAIL" -u "[$THISSERVER] server may need some updates applied" -m "$(cat /tmp/servermail.msg)"
echo "$(date) [MESSAGE] Packages need updating email sent to $MAILTO" >> $LOGFILE echo "$(date) [MESSAGE] Packages need updating email sent to $MAILTO" >> $LOGFILE
fi fi