Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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=<*****>, ctladdr=<*****@*****.ca> (1001/1001),
> delay=01:00:08, xdelay=00:00:00, mailer=esmtp, pri=300329,
>, dsn=4.0.0, stat=Deferred:
> Connection timed out with

Output from netstat :

tcp        0      0   *   LISTEN   15069/sendmail: MTA
tcp        0      0    *   LISTEN   15069/sendmail: MTA

Telnet on 25 is also successful when ran from an other computer (telnet 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?

share|improve this question
Can you send to any other addresses? – ewwhite May 6 '12 at 6:57
Tried 4 other addresses, no succes. – Erwald May 6 '12 at 7:01
The netstat output you listed only shows the ports that your sendmail is listening on for inbound mail... It's not relevant to your mail sending problem. – ewwhite May 6 '12 at 7:12
"The case of the 500 miles mail" :) – adamo May 7 '12 at 6:09

2 Answers 2

up vote 5 down vote accepted

The standard mail troubleshooting steps apply here... From the log, we see that you're able to resolve the MX/DNS records for the 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
# Look for the mail destination IP in the output - "" in this case

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

You should see something similar to:

Connected to (
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.

share|improve this answer
Minor point of clarification (that's probably obvious but I'll mention it anyway): not all people will see asterisks in the 220 banner greeting upon successful connections. – Mike B May 6 '12 at 7:34
For some reason, if I try "telnet the.server.imworkingon 25" is successful from any other computer. BUT if I try to telnet anyother address from the server i'm working on, I get a connection timeout. Port 25 is open with iptables, and it isn't my ISP (dedicated server).. Any other advice? Thank you for your help soo far. – Erwald May 6 '12 at 16:35
The incoming connection to port 25 of the.server.imworkingon does not matter. It still sounds like your ISP may be blocking outgoing email connections. As adamo says, check your ISP's documentation to see whether you are supposed to send all email via your ISP's relay and on a different port. Or use ewwhite's suggestion of trying to telnet to port 25 of your destination ( – ramruma May 6 '12 at 17:43

Connection timeouts to well known services usually mean one of two things:

1- You cannot connect to port 25 of any SMTP server out there because your ISP is blocking this. Check with your ISP whether your machine is allowed to send email directly or via a relay. If a relay is offered by your ISP / hosting provider, add the following line somewhere in the middle of your /etc/mail/ file:

define(`SMART_HOST', `[relay.your.isp.provides]')dnl

Next as root run sendmailconfig and check whether this works.

2- It may be the case that you have a TCP window scaling problem to solve. This can be anything from a cable, to the ethernet card driver, to the card itself, the cable, the switch and any router in between and as a heisenbug it can appear only in your specific configuration. You can try to bypass this by adding the following lines to /etc/sysctl.conf:

net.ipv4.tcp_rmem = 4096 87380 174760
net.ipv4.tcp_wmem = 4096 16384 131072
net.ipv4.tcp_window_scaling = 0

Next as root run sysctl -p and check again whether this solves the problem or not.

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.