Thanks for the reply. So been having problems as centos seems to always want to send mail to port 25 which no one uses anymore. Tried updating the relay to use 587 but if I email Comcast it tries sending it to a mx1 or mx2 Comcast URL which doesn't work anymore. Should be going to smtp.comcast.net. Not your problem. That said, did the following:
[*]touch /etc/postfix/sasl_passwd
[*]chmod 0600 /etc/postfix/sasl_passwd
[*]echo "smtp.comcast.net:587
[email protected]:password" > /etc/postfix/sasl_passwd
[*]postmap hash:/etc/postfix/sasl_passwd
[*]echo '/^([^@]*)@.*$/
[email protected]' > /etc/postfix/sender_rewrite
Edit /etc/postfix/main.cf and add:
[*]relayhost = [smtp.comcast.net]:587
[*]smtp_sasl_auth_enable = yes
[*]smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
[*]smtp_sasl_security_options = noanonymous
[*]smtp_sasl_tls_security_options = noanonymous
[*]
[*]## -- Rewrite all sender addresses:
[*]sender_canonical_maps = regexp:/etc/postfix/sender_rewrite
yum -y install cyrus-sasl-plain
Now I can send thru sendmail using my Comcast host as the host and working. I also removed/reverted any changes the mail client I was using required. What else should I have to change/set if anything to start using the built in mail functionality with Nagios?
Should be noted I do NOT have /bin/mail installed. Not sure if I need to or can modify notify-host-by-email and notify-service-by-email to use sendmail directly? Like to limit my installs.
Thanks.
EDIT: Tried adding the below in place of the current command statements, not sure if they are accurate yet:
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "Subject: $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$\n\n***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/sbin/sendmail -vt $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "Subject: $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$\n\n***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/sbin/sendmail -vt $CONTACTEMAIL$
}