postalserver / postal

📮 A fully featured open source mail delivery platform for incoming & outgoing e-mail

Home Page:https://postalserver.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Postal web interface sends emails to the wrong SMTP port

goldmont opened this issue · comments

Describe the bug

Postal forces port 25 when sending emails from its web interface to itself but SMTP is running on port 2525. Is there a way to set a custom port for the web interface? Postal works perfectly when sending to port 2525 from other services.

I get the error:
No SMTP servers were available for mail.example.com. Invalid argument - connect(2) for "<ip_address>" port 25, execution expired

Expected behaviour

Being able to send emails to port 2525 via Postal web interface.

Screenshots

Outgoing messages:
Screenshot from 2024-03-16 10-07-34

SMTP endpoints:
Screenshot from 2024-03-16 10-02-19

Routes:
Screenshot from 2024-03-16 10-03-48

Environment details

  • OS: Debian 12
  • Browser: Chrome
  • Version: Postal 3.2.2

When you say "Is there a way to set a custom port for the web interface?" what do you mean? What e-mails are you talking about?

When you say "Is there a way to set a custom port for the web interface?" what do you mean? What e-mails are you talking about?

I mean that Postal keeps sending emails to port 25 but my SMTP is running on port 2525. When I send an email via the Send message form (see the screenshot), Postal fails to deliver the message because it's trying to send it to port 25.

Screenshot from 2024-03-16 10-29-33

Of course example.com is not my real domain.

I see now.

No, that's not possible. If you want to receive incoming email to your Postal install from other mail servers (and Postal itself) you will need to listen on port 25.

Postal does not treat outgoing mail any differently whether it's going to itself or any other external server.

I see now.

No, that's not possible. If you want to receive incoming email to your Postal install from other mail servers (and Postal itself) you will need to listen on port 25.

Postal does not treat outgoing mail any differently whether it's going to itself or any other external server.

So could you please explain me what is the purpose of letting the user to set a custom port while creating a new SMTP endpoint? There's something I don't understand or missing in the documentation.

SMTP endpoints are used to route incoming mail to other servers. For example, you can setup specific addresses to go to other servers.

To anyone else having the same issue, you can open port 25 on your firewall and redirect all the traffic to another port on the same host. For example, I had to redirect all the traffic from port 25 to 2525.

Message sent successfully:
Screenshot from 2024-03-16 10-55-55

For future people coming here, I just wanted to add that there is a massive difference between using Postal to send emails via SMTP or API and using the incoming routing.

If you wanted to use the incoming routing, you would have to have a domain with its MX records pointing at Postal and then probably use something else to send the message to that domain (I'm not sure if Postal would be able to SMTP to itself).

Using Postal directly to send messages via SMTP or API will always use the standard port.