postal icon indicating copy to clipboard operation
postal copied to clipboard

How do i configure postal to send emails from 587 or 2525 port instead of 25.

Open jsahani opened this issue 9 years ago • 10 comments

Hi Team,

I have successfully installed Postal and installed my SSL and everything else, the only thing i can't seem to find/understand that how do i configure Postal to send emails from 587 or 2525 port instead of port 25, with TLS as i have a valid SSL cert installed.

Thanks

jsahani avatar May 24 '17 18:05 jsahani

I'm afraid I don't understand your question. Outbound are always sent from a random port, and they are always sent to port 25. As far as I know there is no other way to send emails.

If you're referring to the port that SMTP listens on, this is currently always port 25. Did you want to change this, and if so, why? Doing so is certainly possible, but would break the ability to receive incoming email.

catphish avatar May 25 '17 08:05 catphish

If what you want to do is send emails from your application to Postal using TLS as follows:

smtp_server:
  tls_enabled: true

By default, Postal will look for the key and certifate in config/smtp.key and config/smtp.crt but you can configure this also if desired.

Once this is done, you can send your emails by configuring your client to use STARTTLS which also runs on port 25.

catphish avatar May 25 '17 13:05 catphish

@catphish Thanks for your reply, but i don't want to change the port 25 all i want is to be able to send emails using port 2525 also as right now my mailing server is unable to connect to postal server using port 2525 as suggested by postal setting only. Take a look at this :- https://www.dropbox.com/s/79ld8qmrgqu1plf/Screenshot%202017-05-25%2022.38.31.png?dl=0

Edit:- When ever i try to connect to postal server from my email marketing software this is the error is get. :-

Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): unable to connect to smtp.mypostaldomain.com:2525 (Connection refused) SMTP ERROR: Failed to connect to server: Connection refused (111)

Can you please tell me where do i have to place this code:

smtp_server: tls_enabled: true

Thanks

jsahani avatar May 25 '17 17:05 jsahani

By default, the only port open is 25. You can configure this in postal.yml : smtp_server: port: 25 But I suggest you to keep port 25 open and use iptables/prerouting to add 2525 or 587

jlnmrc avatar May 26 '17 03:05 jlnmrc

I'm afraid I don't understand your question. Outbound are always sent from a random port, and they are always sent to port 25. As far as I know there is no other way to send emails.

If you're referring to the port that SMTP listens on, this is currently always port 25. Did you want to change this, and if so, why? Doing so is certainly possible, but would break the ability to receive incoming email.

Hi @catphish , Just wanted to understand the second point.... When I do a google search: "what port gmail smtp use", the answer says 465. Say, in a scenario, port 25 is blocked, and instead another port is to be used for sending and receiving mails where MX records only point to IP set through a domain manager (say godaddy), is that not possible?

Gullimama avatar Jul 18 '20 21:07 Gullimama

sending and receiving

Sending, and receiving, are completely different things.

Receiving email can absolutely only be done on port 25. This is the only port that an MX record can point to.

When sending email, your email relay server could listen on any port.

Postal uses port 25 for both.

catphish avatar Jul 18 '20 21:07 catphish

I also need to open port 587 or 465

mishudm avatar Sep 02 '20 02:09 mishudm

Caddy generated ssl location is: /opt/postal/caddy-data/caddy/certificates/acme-v02.api.letsencrypt.org-directory/postal.domain.com/postal.domain.com.crt and key but not work 587 port + anoter Postal problem is: NOT possible send from to same email.. example [email protected] to [email protected] impossible send email! WHY??

usr-h avatar Sep 17 '22 19:09 usr-h

Port 587 is SMTP submission, from clients to an MTA to be relayed over the Internet - which is the outbound use case of postal server.

25 should be supported for submission, but 587 should be encouraged in preference to 25.

Weird that DNAT is the proposed solution here, it's very useful to be able to get metrics over which clients used 25 and which used 587.

nward avatar Feb 27 '25 05:02 nward

This works for me: sudo iptables -t nat -A PREROUTING -p tcp --dport 587 -j REDIRECT --to-port 25

JoSoG89 avatar Jul 24 '25 20:07 JoSoG89