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 have run into a number of problems getting sendmail to work. None of the solutions I've tried have worked.

First: sendmail was hanging for 60 seconds and then not sending the email.

To solve this, I used suggestions from the web to set my /etc/hostname to a fully qualified domain name (FQDN) and then put that in /etc/hosts as well. This did get rid of the hanging, but I still never receieve any emails sent from sendmail.

Second: Installed postfix

This did not fix the issue. Sending an email via sendmail or mail at the command line both fail. Example:

echo "a message" | sendmail
echo "a message" | mail

Both commands return instantly without error, but no email is ever recieved at the gmail account.

I made sure a port was open at 25 in the router as well (although this shouldn't be an issue as Thunderbird can send emails behind the router).

I need to get this working for PHP but cannot figure out where in the many steps from the program to the remote email server it is failing. How would I figure this out?

share|improve this question
what does /var/log/maillog or where the mail logs end up say? – Petter H Aug 23 '13 at 5:03
@PetterH It has a LOT of info/errors but the latest one from an attempt to send to a yahoo address: Aug 23 01:18:32 mycomputer postfix/smtp[2122]: connect to[]:25: Connection timed out – Don Rhummy Aug 23 '13 at 5:21
Do you have DNS resolver configured properly? – dsmsk80 Aug 23 '13 at 5:23
and is your mail server able to reach on port 25? – Petter H Aug 23 '13 at 5:25
@dsumsky How can I check that? – Don Rhummy Aug 23 '13 at 5:31

server should be able to connect to other smtp servers

$ nc -v 25
Connection to 25 port [tcp/smtp] succeeded!
220 ESMTP YSmtpProxy service ready

This is how it can look when port 25 is closed for outgoing traffic:

$ nc -v 25
nc: connect to port 25 (tcp) failed: Connection timed out 

See if the requests get blocked in your firewalls.

share|improve this answer
I turned off the firewall on the server and it still times out. – Don Rhummy Aug 23 '13 at 15:15
there might be other firewalls on the way? – Petter H Aug 23 '13 at 15:40
How do I determine that? The only things are: server->router->cable modem->ISP – Don Rhummy Aug 23 '13 at 16:07

Have you tried other ports than 25? Most likely you won't have this problem when your not behind a residential ISP. Also when you say thunderbird sends mail, are you authenticating to the server in question? If not then you are probably connecting to another server over a ssl port.

share|improve this answer
I tried using port 587 but have not yet had it work. – Don Rhummy Sep 3 '13 at 19:46
What I meant is have you tried using a non-standard SMTP port? Both 25, and 587 are standard SMTP ports which would be filtered at some residential gateways. – Shapeshifter Sep 4 '13 at 19:02
How would I send email if I was doing that? (Serious question) For example, if I'm trying to use sendmail to send an email to a gmail address, GMail wouldn't be listening on port 444 (as an example), correct? Or am I misunderstanding? – Don Rhummy Sep 4 '13 at 23:44
Where is the server located? Is it a dedicated server behind the residential gateway? You are not sending mail to a server on a non-standard port, you would be connecting via SMTP to a non-standard port and then sending to the recipient server. If you are behind a residential gateway that will not unblock either SMTP ports you will need to configure for smarthost mail relay. – Shapeshifter Sep 5 '13 at 17:47
However, if you are trying to produce this in a test-environment that is similar to your production environment I would double check that the production environment is behind a residential gateway as well otherise you may be wasting time – Shapeshifter Sep 5 '13 at 17:47

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.