Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 someemail@gmail.com
echo "a message" | mail someemail@gmail.com

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
1  
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 mta5.am0.yahoodns.net[66.196.118.34]: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 mta5.am0.yahoodns.net 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

2 Answers 2

server should be able to connect to other smtp servers

$ nc -v mta5.am0.yahoodns.net 25
Connection to mta5.am0.yahoodns.net 25 port [tcp/smtp] succeeded!
220 mta1193.mail.ne1.yahoo.com ESMTP YSmtpProxy service ready
^C

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

$ nc -v mta5.am0.yahoodns.net 25
nc: connect to mta5.am0.yahoodns.net 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

 
discard

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.