3

I'm trying to finish up my Nagios install by having it email me. It was emailing me using /bin/mail so it always got sent to my spam folders. I installed sSMTP to try to send a request to my work's email server to be able to send out a message from an authenticated user.

Here is my /etc/ssmtp/ssmtp.conf file:

mailhub=10.200.120.148:25
UseTLS=NO
AuthUser= nagios@domain.com
AuthPass=PASSWORD

So far I've been using the following command, and it will still arrive to my email inbox as root@localhost which causes it to go to my spam folder (with the exception of one email provider I have).

cat message |ssmtp me@myemail.com

I've looked at a few examples online, and they all seem to have pretty much the same as me. Does anybody see the any mistakes that I'm making?

Just to clarify, nagios@domain.com is a user on the mail server that my work uses.

2 Answers2

2

I'd start with sending a message while running tcpdump -A port 25 and watching the SMTP conversation.

If the remote mail system says the message is queued then sSMTP is working fine, and you'll have to look at the remote mail server. If it doesn't say it's queued, then try to fix whatever it says is wrong.

If you don't see any connections, only then is the problem is with sSMTP.

bahamat
  • 6,433
1

Okay, I was able to get it to work, so here is some documentation for others who may have had a similar problem:

Here is the vim /etc/ssmtp/ssmtp.conf file:

# Email address the mail is sent from (account created on the SMTP server)   
root=nagios@domain.com

# IP-address of the mail server
mailhub=10.200.120.148:25

# Domain of the mail server
RewriteDomain=domain.com

# Local machine's name
Hostname=nagios.localdomain

FromLineOverride=YES
UseTLS=NO

# Email account and password 
AuthUser=nagios@domain.com
AuthPass=password

In order to use this, I run the following command: (Make sure not to put spaces after the \n in the below command)

echo -e "To: me@gmail.com\nFrom: nagios@domain.com\nSubject: Nagios Notification\n\n Hello, this is a test"|ssmtp me@gmail.com

This results in the my gmail account recieving the email sent from nagios@domain.com and not ending up in the Spam folder.

Thanks all for your help