Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get around an ISP block on port 25 for SMTP

Tags:

smtp

blocking

Yes, this question has been answered in a variety of ways, none of which, are answered in a way that fit my needs. So, therefore I'm asking mine specific to my situation.

I've tried, probably 5 or 6 different ways for setting up a mail (SMTP) server on my spare computer at home that I've also set to run my website. My ISP blocks several ports like 80 and 25 that allow for hosting web servers, mail servers, ftp servers. etc. Luckily, my domain registrar had a way to forward my traffic to a specific port where then I used some options in my router to do port translation and redirect traffic from one port specified in my account settings on my registrar's site to go to port 80 on my web server computer, which worked just fine, and my website is up.

However, I've come to find out that by default, when setting up an MX record so I can set up a mail server, their system by default sends traffic to port 25. (So rather than the web server pointer that I can specify: 012.345.678.910:8080, the MX record has to be something like mail.mydomain.com or simply mydomain.com. There is no way in their options (currently) to specify a port like you can for the website. So, I guess this is a 2 part question. 1. Did I just happen to choose a crappy domain registrar; or specifically, is this a capability offered by default by a lot of other domain registrar's that I'm just missing out on? and 2. Is there any other way to make this happen? My ISP charges and arm and a leg for Business accounts that unlock port 25, and I'd like to not have to go that route. I understand you can set your SMTP server to listen and send out traffic on a different port, but that does me no good if my domain registrar's MX record is still forwarding to port 25 for incoming mail. Any help or advice on this matter would be greatly appreciated. Thanks.

EDIT:

I left out the obvious possibility that I could be messing up my setup in regard to the fact that I've never successfully set up an SMTP server before so I'm quite new to this. With that sad, could I be confused on how mail servers operate, is there a difference or possibility of an ISP blocking incoming traffic on a port vice outgoing? What I mean is, am I confused in that if I've set up everything properly, should I be able to receive (listen) or port 25 no matter what, and then have to send outgoing mail out on an unblocked smtp port?

I've yet to try sending out mail from my server due to the fact that I don't want to have things set up wrong and then get my IP blacklisted, so I've only tried experimenting with trying to receive email and as I've said, I've tried about 5 or 6 (all very confusing and seemingly incomplete or not very detailed) tutorials on how to set up an SMTP server, and I have yet to get incoming mail either. As a personal note, it seems weird to me that out of the several tutorials I've searched and read, that not one bares nearly any similarity to the next with regard to the first part of installing postfix; from there, it all becomes different. This doesn't help me understand what I could be doing wrong if indeed that is what is happening. Finally just for continuity, I did go to http://port25.icannotconnect.com/ and it did indeed say "BLOCKED".

Thanks again.

like image 786
TekGiant Avatar asked Aug 09 '13 02:08

TekGiant


4 Answers

There is a free service at rollernet.us that you can use to redirect your incoming mail to another port, say 26, on your smtp server. This is for low volume service; if you are receiving many or large emails then you will get temporarily suspended. Also (I have not tried this) ghettosmtp.com claims to offer this service. You can Google smtp port redirect to find commercial services for less than $100 per year.

like image 146
rleir Avatar answered Oct 26 '22 16:10

rleir


Interesting question. You seem to basically understand how SMTP works as far as MX records, IP addresses, and port 25 (which is the standard port that SMTP servers accept connections on from other SMTP servers).

I think what you are referring to that your domain registrar does with your web site is basically an HTTP redirect. It sounds like you must have the A record for your domain pointing to the IP address of a web server at your registrar, and this web servers does an HTTP (301 or 3012) redirect to your home IP address on port 8080. Unfortunately, there is not a similar type of redirect in the SMTP protocol.

As a workaround that would be considerably less that an extra $50/month, you might want to setup a mail server on a Linux cloud server. Linux cloud servers at Rackspace start at around $16/month, and you would have a static IP without any blocked ports: http://www.rackspace.com/cloud/servers/

like image 35
mti2935 Avatar answered Oct 26 '22 17:10

mti2935


If you use Exim as your MTA, one approach would be:

  • Set up a shell-less account (i.e. chsh to /bin/false) on any UNIX server running a SSH daemon.
  • Set up an autossh service on your mail server, with a DynamicForward listening on a local port
  • Use socks_proxy in Exim (on the SMTP transport) to cause it to tunnel all outgoing SMTP/submission connections through the SSH tunnel.

The advantage of using this over a smart host (as described in the other answers) is that, assuming the destination mail server has TLS enabled, there is no intermediary through which your mail passes as plain text, and therefore no intermediary has a chance to snoop on or tamper with your mail.

like image 29
Vladimir Panteleev Avatar answered Oct 26 '22 16:10

Vladimir Panteleev


I operate a remote linux server running sendmail. Ports 25, 465 and 587 are blocked so there was no way to bypass the block without taking drastic measures. I tried a random port and it worked well except that it had to run in open mail relay mode and many mail servers rejected my email based on this fact.

The solution was to build my own email transport sytem in PERL, which triggers sendmail while operating as a daemon on my linux box. I set my email client to use the same high range port for smtp. Now everything is under my direct control and it has been working perfectly since late 2014.

While, this is not a solution that fits your critera, it may help someone else and l'll just make two more comments.

1) Each VPS I have costs only $20.00 per year so its very affordable; and

2) You'll have better web performance if your site is housed in a data center.

like image 43
Peter Avatar answered Oct 26 '22 16:10

Peter