I have Nagios 3 installed. To send email notifications I installed msmtp and configured it this way:
defaults
auth on
tls on
# A first gmail address
account default
host smtp.gmail.com
port 587
from my_account@gmail.com
user my_account@gmail.com
password my_password
tls_trust_file /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt
I put .msmtprc to the /var/lib/nagios forder (it's nagios' home folder) and then chowned it to nagios and chmoded it to 0600.
I checked /usr/bin/mail works great. However I cannot receive notifications from nagios.
[1311248385] EXTERNAL COMMAND: SEND_CUSTOM_SVC_NOTIFICATION;allinone;Account administration service;0;nagiosadmin;test failure 2
[1311248385] SERVICE NOTIFICATION: roman;allinone;Account administration service;CUSTOM (CRITICAL);notify-service-by-email;Connection refused;nagiosadmin;test failure 2
[1311248385] SERVICE NOTIFICATION: pavel;allinone;Account administration service;CUSTOM (CRITICAL);notify-service-by-email;Connection refused;nagiosadmin;test failure 2