Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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

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, is a user on the mail server that my work uses.

share|improve this question
also you have to revision your firewall ports and remember that to allow to the port like 25 – amroesam Jul 7 '12 at 3:05
Your title and body seem to disagree... is the mail being sent but marked as spam, or not getting sent? Some logs would be nice to see. – womble Jul 7 '12 at 4:50
Just for documentation, the problem was that the conf file was incorrect so the external SMTP server was receiving the request, but was sending it from the wrong email address ( instead of which is a valid/created email address on the server) Conf file fix posted below – OrangeGrover Jul 9 '12 at 16:17

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.

share|improve this answer
Thanks, the server was acknowledging the receipt of the email, but still sending as the wrong address, so the problem was in the conf file. – OrangeGrover Jul 9 '12 at 16:15
up vote 0 down vote accepted

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)

# IP-address of the mail server

# Domain of the mail server

# Local machine's name


# Email account and 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:\nFrom:\nSubject: Nagios Notification\n\n Hello, this is a test"|ssmtp

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

Thanks all for your help

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.