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

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'm trying to set up sendmail to receive system messages on my real email account. I've set up alias for root and started newaliases. Now mailq reports:

Deferred: Connection timed out with

I suspect it due to ISP blocking port 25 (I cannot telnet on this port to my mail server, telneting with port 587 works fine).

My question is how to configure sendamil, to connect with other servers using port 587 instead of 25? I'm using TurnKey Core (Ubuntu 10.04 based) distro.

share|improve this question

You may look into some of the SMTP relay services like which can assist with alternative port relaying of SMTP traffic.

The other consideration is that when this occurs with a lot of ISPs, it is because they have restricted the hosting of servers/servicer services within the AUP for the class of services you are subscribed to. If that is the case, then some ISPs may find that violating their AUP is cause for them to drop you as their subscriber or "upgrade" you to (in their view) an appropriate service offering.

share|improve this answer

Your question is based upon confusion. You have a message that is clearly about outbound mail, and you are asking how to receive inbound mail.

Receiving inbound SMTP mail requires that the rest of the world be able to connect to the SMTP Relay port on your machine — no ifs, buts, maybes, or alternative ports. (Unless they are using MTSes like exim and so forth that have come into the 21st century and understand SRV resource records for _smtp._tcp..) If your ISP has prevented the rest of the world from doing this, you are dead in the water to all except the 21st century MTS users. At best you'll have to make do with some store-and-forward arrangement via your ISP.

Most ISPs that block ports, however, more usually block you from connecting to the SMTP Relay port on other people's servers on the rest of Internet. That's a concern for sending outbound mail, not for receiving inbound mail. And it's done precisely to stop ISP customers from sending mail directly to other people.

So sort out exactly what is being blocked, and what direction of mail travel you are concerned with.

share|improve this answer
I do not want to receive anything into my server or anyone to connect to it. I've got few cron jobs running and I want to be able to receive emails from these scripts (like echo "job1 finished" | mail -s "job1 status" on my existing email account. So my question is how to connect to other server SMTP Relay, knowing that my ISP is blocking port 25. – dev-null-dweller Jun 19 '11 at 14:30
If the other SMTP server(s) is/are one(s) that you control, then you can still set them up for non-port 25 (as an additional alternative listening port for many) SMTP. You can then setup communications between your cron job server and the other end-point server(s) over the non-port 25 definition. Or still consider/use a SMTP relay service. – user48838 Jun 19 '11 at 18:37
So fix your question to say that, because it doesn't at the moment. – JdeBP Jun 20 '11 at 10:52

It is common (and in my mind desirable) for ISPs to block outgoing connections to port 25. This is is a feature which helps prevent spambots on their network from being fully effective. The vast majority of the Spam I block is from infected PCs running spambots.

Your best option is to configure you server to relay via your ISPs relay server. If they are blocking port 25, they will almost certainly provide such a server.

Alternatively, you may be able to use an encrypted and authenticated connection to the submission port (587) on the host you want to send email to. SMTPS (465) is not commonly supported, but may not be blocked if your mail server supports it.

EDIT: Sendmail is likely overkill in your case. Exim4 and Postfix are alternate full implementations which could also be overkill. postfix and exim4 tend to be installed more often than sendmail.

One of the relay only SMTP forwarders might be easier more appropriate and easier to configure. These include esmtp, msmtp, and ssmtp. They will forward all mail to other servers, so are not appropriate if you want to receive some mail on the server.

In any case you should configure your host as a satellite of your ISP's mail relay. You will also need to setup the appropriate aliasing so that your email is delivered to your desired email address. This is done in /etc/aliases for sendmail, postfix, and exim4. These programs may also use /etc/email-addresses to rewrite the sender address.

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.