How to change the SMTP delivery port from 25 to 26

Questions and answers about how to do stuff
Post Reply
kidtriton
Posts: 13
Joined: 24 Mar 2016 14:44

How to change the SMTP delivery port from 25 to 26

Post by kidtriton »

My Exchange server is behind a home account that blocks port 25. I also used to run EFA behind that same router and used a service called GhettoSMTP to send all my incoming mail to port 26 and then I used a Cisco router nat statement to map incoming port 26 to internal port 25 of the EFA server. So in EFA it was fine for it to receive email on 25 and then deliver it on port 25 to my Exchange server since it was inside the network.

Today I'm deploying a replacement EFA server in an outside environment that allows port 25 but my Exchange server will still be behind my ISP that blocks port 25. So can drop GhettoSMTP and set my MX records to deliver to this new EFA server on 25 but I need it to then send the mail on to my Exchange server on port 26. In the menu setup under Mail Settings > Transport Settings it won't let me input hostname:26 but using webmin and looking at the /etc/postfix/transport file I can enter smtp:[hostname:26] but I don't think that is working.

What is the correct way to haave EFA deliver mail from it to the Exchange server using a port other than 25?
User avatar
shawniverson
Posts: 3644
Joined: 13 Jan 2014 23:30
Location: Indianapolis, Indiana USA
Contact:

Re: How to change the SMTP delivery port from 25 to 26

Post by shawniverson »

Did you postmap the transport file?

Code: Select all

sudo postmap /etc/postfix/transport
sudo service postfix reload
kidtriton
Posts: 13
Joined: 24 Mar 2016 14:44

Re: How to change the SMTP delivery port from 25 to 26

Post by kidtriton »

I didn't do those two commands at first but I just did and tried again and still getting a status of (unknown mail transport error)

here is the entry at the end of the /etc/postfix/transport file, is this correct?

# START E.F.A ADDED DOMAINS ######
mydomain.net smtp:[mailserver.mydomain.net:26]

If I telnet across the Internet to mailserver.mydomain.net 26 I can manually talk to my exchange server and send it a message so name resolution and the port 26 through my firewall is working.

Is there something like a firewall rule somewhere else on the EFA server that has to be modified? Or somewhere else I should be trying to change the sending port from 25 to 26?
kidtriton
Posts: 13
Joined: 24 Mar 2016 14:44

Re: How to change the SMTP delivery port from 25 to 26

Post by kidtriton »

I also edited the /etc/postfix/transport file to have the IP address instead of fqdn like this:

# START E.F.A ADDED DOMAINS ######
mydomain.net smtp:[xxx.xxx.xxx.xxx:26]

but it still doesn't work. And I'm finding this in the logs:


postfix/smtp[12848]: fatal: valid hostname or network address required in server description: [hostname.mydomain.net:26]

or after changing it to IP address:

postfix/smtp[15433]: fatal: valid hostname or network address required in server description: [xxx.xxx.xxx.xxx:26]

So does this mean that putting the :26 here is not accepted?

my message failure in the logs looks like this:

postfix/error[15436]: 343D81202B8: to=<name@mydomain.net>, relay=none, delay=17563, delays=17561/1/0/0.01, dsn=4.3.0, status=deferred (unknown mail transport error)


I dug back further and before I started trying the :26 in the transport mapping the error was this, which just looks like it was because it was trying port 25, which is closed on the other end.

postfix/smtp[1670]: 3709D120073: to=<name@mydomain.net>, relay=none, delay=950, delays=919/0.08/30/0, dsn=4.4.1, status=deferred (connect to mailserver.mydomain.net[xxx.xxx.xxx.xxx]:25: Connection timed out)

So I'm thinking the whole syntax I'm trying to use or where I'm trying to make this change is all wrong since now it says unknown transport error instead of a time out.


EDIT: and I just changed the mapping back to the mailserver.mydomain.net without the :26 and the error is back to saying Connection time out instead of Unknown transport error so I'm pretty sure this is not the way to change the outgoing port number.
kidtriton
Posts: 13
Joined: 24 Mar 2016 14:44

Re: How to change the SMTP delivery port from 25 to 26

Post by kidtriton »

I fixed it!

It is done there in the /etc/postfix/transport file but the syntax is for the :26 to be outside the brakets.

So instead of:

# START E.F.A ADDED DOMAINS ######
mydomain.net smtp:[mailserver.mydomain.net:26]

It's supposed to be:

# START E.F.A ADDED DOMAINS ######
mydomain.net smtp:[mailserver.mydomain.net]:26
Post Reply