Email connection using port 25, rather than default 587

For new rebuild email connection while admin registration is using port 25, rather than default 587, however sample configuration file says otherwise

#DISCOURSE_SMTP_PORT: 587 # (optional, default 587)

Rails logs shows connection attempt to port 25 in default configuration

Job exception: Timeout to open TCP connection to (exceeds 5 seconds)


Yes, I think I can substantiate that with source code:

The last commit was 9 years ago, so this has probably been the default for a while! :mantelpiece_clock:

Moved this to #bug even though it’s not a code issue, it’s almost certainly incorrect in the settings template?


So set it rather than accepting the default. discourse-setup sets it.

Maybe it’s more like #ux?

it’s been this way for 9 years and this is the first reported issue. When one more person reports having an issue with this I’m sure it’ll get moved to the top of the list, though someone could try submitting a PR if they want.

1 Like

Not everybody run discourse-setup, instead they use web and data yml files directly to create multiple instance running on same system. But yeah not a high priority to resolve.

Unless you’re familiar with performance tuning discourse for different CPU and memory configurations on Discourse I wouldn’t sidestep discourse-setup entirely.


It seems like you’re the first person in almost a decade to report a problem. I would imagine that everyone else just set it rather than hoping the default would work. It’s assumed that if you don’t run discourse-setup then it’s because you can handle it.


Doesn’t hurt to change the comment here to 25

as it looks like ./discourse-setup assumes that the values on the sample file are Discourse defaults?


It does. It trusts the templates rather than parsing the configuration file.

discourse-setup always sets a value (it won’t leave the line commented out); those who use discourse-setup will never have a problem with the default SMTP port being “wrong”; that’s why this seems the be the first time this has come up. (And it would seem that even before discourse-setup existed, no one decided to leave the port commented out and expect the default to be 587; it just makes more sense to set the port rather than hoping that the default works). Changing it to 25 in standalone.yml and web_only.yml will encourage people who do use discourse-setup to use port 25, which will likely mean that a bunch of people will have to type 587 rather than just hitting enter, and some others, who don’t know what a port is, will blindly accept the default and probably have problems figuring that out. I think that there will be more people in the set than those who know how to edit a text file and choose leave the SMTP port commented out rather than entering the value that they actually want.

The only time this “bug” can occur is if someone edits standalone.yml by hand and chooses to leave the SMTP port commented out rather than providing a value. Whether the templates are wrong or the actual default is wrong is unclear.

1 Like