From 9364900314ded8fce0a0383343c24f7d95194564 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Fri, 15 Jul 2016 21:38:11 +0200 Subject: [PATCH] notify.sh create password base64 encoded functions for notifing --- notify.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 notify.sh diff --git a/notify.sh b/notify.sh new file mode 100755 index 0000000..6dd9306 --- /dev/null +++ b/notify.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# default no notify +# it will be set in .ablentohandy.conf +NOTIFY=false + +MESSAGE="" +# load all parameters to sendemail over smtp +if [ ! -f $HOME/.albentohandy.conf ] +then + printf "\nERROR\n.albentohandy.conf does not exist\n" + exit 1 +else + source $HOME/.albentohandy.conf +fi + +# send email to notify user +sendEmail() +{ +if [ $NOTIFY == true ] +then + sendemail -f $FROMADDRESS -t $TOADDRESS \ +-s $SMTP -xu $SMTPUSERNAME -xp $(echo $SMTPPASSWORD | base64 --decode) -o tls=yes \ +-u "albentohandy" -o message-content-type=html -m "$MESSAGE" +fi +} + +currentDate() +{ + MESSAGE="${MESSAGE}$(date +"%Y-%m-%d %H:%M:%S") " +} + +openMail() +{ + MESSAGE="\n \ +\n \ +albentohandy.sh notify\n \ +\n \ +\n" +} + +addInfo() +{ + MESSAGE="${MESSAGE}$1\n" +} + +closeMail() +{ + MESSAGE="${MESSAGE}\n \ +\n \ +\n" +} -- 2.47.3