The the host-notify-by-sendemail & service-notify-by-sendemail commands use the sendEmail perl script to send email notifications. sendEmail has many options that can be used to configure sending email for more complex mail system requirements, including using an external smtp server to send email.
To use an external smtp server you will need to add the -xu, and -xp flags to the sendEmail command. We will also need to set user macros to represent the parameters we need to pass to sendEmail. In this example we will use USER13 for the smtp server, USER14 for the SMTP username & USER15 as the SMTP password.
/usr/bin/printf "%b" "<html><b>+++++ HOST $NOTIFICATIONTYPE$ : $HOSTSTATE$
+++++<br>$LONGDATETIME$</b><br>Host: <b>$HOSTALIAS$ ($HOSTADDRESS$)</b></b><br>Message:
<b>$HOSTOUTPUT$</b></html>" | /usr/local/groundwork/common/bin/sendEmail -s $USER13$
-xu $USER14$ -xp $USER15$ -q -f $ADMINEMAIL$ -t $CONTACTEMAIL$ -u "[GW] ++ $HOSTNAME$ :
$HOSTSTATE$ ++"
/usr/bin/printf "%b" "<html><b>+++++ SERVICE $NOTIFICATIONTYPE$ : $SERVICESTATE$
+++++<br>$LONGDATETIME$</b><br>Host: <b>$HOSTALIAS$ ($HOSTADDRESS$)</b></b><br>Message:
<b>$SERVICEOUTPUT$</b></html>" | /usr/local/groundwork/common/bin/sendEmail -s $USER13$
-xu $USER14$ -xp $USER15$ -q -f $ADMINEMAIL$ -t $CONTACTEMAIL$ -u "[GW] ++ $HOSTNAME$ :
$SERVICEDESC$ : $SERVICESTATE$ ++"
Now you should be able to use the host-notify-by-sendemail and service-notify-by-sendemail commands in your contact templates for notifications.
Configuration -> Contacts -> Contact templates -> modify -> NameOfTemplate
Or for individual contacts:
Configuration -> Contacts -> Contacts -> modify -> NameOfContact
The full list of settings for sendEmail are as follows:
/usr/local/groundwork/common/bin/sendEmail --help sendEmail-1.52 by Brandon Zehm <[email protected]> Synopsis: sendEmail -f ADDRESS [options] Required: -f ADDRESS from (sender) email address * At least one recipient required via -t, -cc, or -bcc * Message body required via -m, STDIN, or -o message-file=FILE Common: -t ADDRESS [ADDR ...] to email address(es) -u SUBJECT message subject -m MESSAGE message body -s SERVER[:PORT] smtp mail relay, default is localhost:25 Optional: -a FILE [FILE ...] file attachment(s) -cc ADDRESS [ADDR ...] cc email address(es) -bcc ADDRESS [ADDR ...] bcc email address(es) Paranormal: -xu USERNAME authentication user (for SMTP authentication) -xp PASSWORD authentication password (for SMTP authentication) -l LOGFILE log to the specified file -v verbosity, use multiple times for greater effect -q be quiet (no stdout output) -o NAME=VALUE see extended help topic "misc" for details Help: --help TOPIC The following extended help topics are available: addressing explain addressing and related options message explain message body input and related options misc explain -xu, -xp, and others networking explain -s, etc output explain logging and other output options