sendmail is not delivering messages to recipients

13,116

Solution 1

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.

Solution 2

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:
13,116

Related videos on Youtube

Don Rhummy
Author by

Don Rhummy

Updated on September 18, 2022

Comments

  • Don Rhummy
    Don Rhummy over 1 year

    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 [email protected]
    echo "a message" | mail [email protected]
    

    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?

    • Petter H
      Petter H over 10 years
      what does /var/log/maillog or where the mail logs end up say?
    • Don Rhummy
      Don Rhummy over 10 years
      @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
    • dsmsk80
      dsmsk80 over 10 years
      Do you have DNS resolver configured properly?
    • Petter H
      Petter H over 10 years
      and is your mail server able to reach mta5.am0.yahoodns.net on port 25?
    • Don Rhummy
      Don Rhummy over 10 years
      @dsumsky How can I check that?
    • Don Rhummy
      Don Rhummy over 10 years
      @PetterH How do I find out if it can? When I try to telnet to that address it doesn't go through. It just keeps trying at all the different IP addresses it find for it (so it's finding the IP's via DNS) For example: Trying 66.196.118.34... (I can ping it from the mail server though)
    • Petter H
      Petter H over 10 years
      try nc -v mta5.am0.yahoodns.net 25 or something
    • Don Rhummy
      Don Rhummy over 10 years
      @PetterH nc: connect to mta5.am0.yahoodns.net port 25 (tcp) failed: Connection timed out
    • dsmsk80
      dsmsk80 over 10 years
      So DNS resolution works. Just to be really sure, try the same nc/telent with any of the servers listed by command "host -t mx gmail.com" or "dig gmail.com mx".
    • Don Rhummy
      Don Rhummy over 10 years
      @dsumsky both nc and telnet fail to the servers returned by that command. nc: connect to alt4.gmail-smtp-in.l.google.com port 25 (tcp) failed: Connection timed out nc: connect to alt4.gmail-smtp-in.l.google.com port 25 (tcp) failed: Network is unreachable
    • Rahul Patil
      Rahul Patil over 10 years
      have you tried sendEmail ? caspian.dotconf.net/menu/Software/SendEmail
    • Don Rhummy
      Don Rhummy over 10 years
      @RahulPatil I need something that will work from PHP. This environment is a testing environment and I won't be able to install command line tools on the main server so I want to mimick that closely. Thanks for the thought though! :)
    • Rahul Patil
      Rahul Patil over 10 years
    • Jenny D
      Jenny D over 5 years
      Possible duplicate of ISP blocking port 25
  • Don Rhummy
    Don Rhummy over 10 years
    I turned off the firewall on the server and it still times out.
  • Petter H
    Petter H over 10 years
    there might be other firewalls on the way?
  • Don Rhummy
    Don Rhummy over 10 years
    How do I determine that? The only things are: server->router->cable modem->ISP
  • Shapeshifter
    Shapeshifter over 10 years
    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.
  • Don Rhummy
    Don Rhummy over 10 years
    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?
  • Shapeshifter
    Shapeshifter over 10 years
    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
    Shapeshifter over 10 years
    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
  • David Schwartz
    David Schwartz over 5 years
    @DonRhummy Submitting an email to a mail server as its originator is a different process from one mail server forwarding mail to another server. Likely the former is permitted but the latter is not. You have clear evidence -- you can't connect to these servers on port 25. So it seems port 25 is blocked by your ISP.