0

I'm operating a Postfix server, and my local network has port 25 blocked. I've tried everything I can to in order to get port 25 unblocked - no dice.

Unlike this I don't want to proxy my data. (Haven't found a good way to do it since I don't have external servers) I'd rather just send stuff over port 587 instead of 25 - since 587 isn't blocked for some reason.

How exactly do I go about setting my postfix config to send emails on port 587? I'm fairly sure the hosts I'll be sending to support port 587. An alternative could be proxying if it still sends from the email account on my server, is free, and doesn't use OAuth2 (I'm specifically setting this up because of misconfiguration of platforms like Outlook, and Gmail demanding OAuth2).

I'd like to note that I'm using Ubuntu 20.04 LTS as my server base - so CentOS/RHEL tricks won't work.

2
  • serverfault.com/questions/911172/…
    – AnFi
    Feb 3, 2021 at 8:37
  • Note doing so only allows you to send mail to specific servers and not to all recipients. Typically mail servers only accept incoming mail from other (unauthenticated) servers on TCP port 25 and nowhere else
    – Bob
    Feb 3, 2021 at 13:25

1 Answer 1

0

Specifying different destination ports per domain

You will have to make a list of domains that you are emailing and you have confirmed support receiving email on port 587 for this to work. I assume you have a relationship with these companies that are listening on that port and they are expecting you to do this. I also assume that port 25 is blocked for policy reasons? If so, following these steps is circumventing a security policy and may have consequences.

The file you need to edit is /etc/postfix/transport and use the format specified in this man page on postfix transport

Remember to postmap that file any time you make changes and reload postfix. After you have done this, send some test emails and check your mailq to see if any of them are stuck or they are trying to reach port 25. This will also be in syslog.

The file /etc/postfix/main.cf will also need

transport_maps = hash:/etc/postfix/transport

If you find that your systems are trying to reach servers that do not accept email on that port, then you would need to add header checks to reject those emails or find a way to unblock port 25.

Not the answer you're looking for? Browse other questions tagged .