Debian – Sendmail connection timeout

debianemailsendmail

I recently setup a new Debian server,

After installing and setting up sendmail for the first time, I am not able to send e-mail.

Reason : Connection timeout.

Output from the /var/log/mail.log :

> May  6 02:42:53 k***** sm-mta[15070]: q465gjxF013677:
> to=<*****@gmail.com>, ctladdr=<*****@*****.ca> (1001/1001),
> delay=01:00:08, xdelay=00:00:00, mailer=esmtp, pri=300329,
> relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred:
> Connection timed out with alt4.gmail-smtp-in.l.google.com.

Output from netstat :

tcp        0      0 0.0.0.0:587             0.0.0.0:*   LISTEN   15069/sendmail: MTA
tcp        0      0 0.0.0.0:25              0.0.0.0:*   LISTEN   15069/sendmail: MTA

Telnet on 25 is also successful when ran from an other computer (telnet theserver.imworkingon.com 25) but not if I try to run it from the server im working on. This is telling me that somehow the outbound port 25 seems to be blocked…

Anyone have any ideas?

Best Answer

The standard mail troubleshooting steps apply here... From the log, we see that you're able to resolve the MX/DNS records for the gmail.com destination you're sending to. So this isn't a DNS or routing issue.

Since this is a basic SMTP delivery, try using telnet to port 25 to make sure you're able to connect to the destination host...

I'd follow this sequence:

dig mx gmail.com
# Look for the mail destination IP in the output - "209.85.225.27" in this case

telnet 209.85.225.27 25
# This is an attempt to telnet to port 25 (smtp) on the recipient's server...

You should see something similar to:

Trying 209.85.225.27...
Connected to iy-in-f27.1e100.net (209.85.225.27).
Escape character is '^]'.
220 ***************************************

If you do not see the above, your outbound port 25 smtp traffic is being blocked either at the machine level (check iptables, etc.) or at the network level (check network firewall or ISP policies).

If you do see a similar message, then you're able to pass mail and shouldn't be receiving timeout errors.

Related Topic