# ./discourse-setup doesn't populate DISCOURSE\_SMTP\_DOMAIN

**URL:** https://meta.discourse.org/t/discourse-setup-doesnt-populate-discourse-smtp-domain/390624
**Category:** Self-hosting
**Tags:** email
**Created:** [December 7, 2025, 12:47pm UTC](https://meta.discourse.org/t/discourse-setup-doesnt-populate-discourse-smtp-domain/390624 "2025-12-07T12:47:08Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)
#### Post date: [December 7, 2025, 12:47pm UTC](https://meta.discourse.org/t/discourse-setup-doesnt-populate-discourse-smtp-domain/390624/1 "2025-12-07T12:47:08Z")

</div>

Hello,

the `./discourse-setup` bash script deosn’t populate `DISCOURSE_SMTP_DOMAIN` in the PUPS configuration file.

I used `rake admin:create` inside the container, to find the following impact to GUI;

 ![image](https://global.discourse-cdn.com/meta/original/4X/5/e/4/5e4691632e6f02a95413e0b1f07c04a38adf861b.png)  
 ![image](https://global.discourse-cdn.com/meta/original/4X/d/1/d/d1d1f3f53b23dc52186b0ea464751ea1af10251e.png)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 7, 2025, 12:48pm UTC](https://meta.discourse.org/t/discourse-setup-doesnt-populate-discourse-smtp-domain/390624/2 "2025-12-07T12:48:52Z")

</div>

For a time it got populated with the host name, I’m pretty sure. But also, in most cases it doesn’t matter.

---

<div class="post-metadata">

### Author: ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)
#### Post date: [December 7, 2025, 12:50pm UTC](https://meta.discourse.org/t/discourse-setup-doesnt-populate-discourse-smtp-domain/390624/3 "2025-12-07T12:50:15Z")

</div>

is there some regex we can use to extract the email domain from after the `@` in `DISCOURSE_NOTIFICATION_EMAIL`

understanding deployment cases where the email domain is different to the web domain.

Something like:

```plaintext
DISCOURSE_SMTP_DOMAIN=$(echo "$DISCOURSE_NOTIFICATION_EMAIL" | sed -E 's/^[^@]+@(.+)$/\1/')

```

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [December 7, 2025, 8:40pm UTC](https://meta.discourse.org/t/discourse-setup-doesnt-populate-discourse-smtp-domain/390624/4 "2025-12-07T20:40:22Z")

</div>

> [@Ethsim2](#):
>
> the `./discourse-setup` bash script deosn’t populate `DISCOURSE_SMTP_DOMAIN`

This variable sets the EHLO hostname used by the client during the SMTP conversation.

Almost nobody needs it and it almost never matters what it’s set to.

(I have encountered zero situations where it matters)

---

<div class="post-metadata">

### Author: ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)
#### Post date: [December 7, 2025, 8:46pm UTC](https://meta.discourse.org/t/discourse-setup-doesnt-populate-discourse-smtp-domain/390624/5 "2025-12-07T20:46:23Z")

</div>

![image](https://global.discourse-cdn.com/meta/original/4X/1/4/8/148c58c98267fa15f8ae6376b2d4b47ede544fab.png)

this was because DO block port 587, should have used 2525 - but not sure how this works with Brevo

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 7, 2025, 8:51pm UTC](https://meta.discourse.org/t/discourse-setup-doesnt-populate-discourse-smtp-domain/390624/6 "2025-12-07T20:51:49Z")

</div>

Arguably it should default to port 2525 or suggest to people that most VMs block SMTP ports and most SMTP services allow on port 2525 (but that’s getting to be a lot of words)

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [December 7, 2025, 9:05pm UTC](https://meta.discourse.org/t/discourse-setup-doesnt-populate-discourse-smtp-domain/390624/7 "2025-12-07T21:05:22Z")

</div>

> [@pfaffman](#):
>
> Arguably it should default to port 2525

The fact that Digital Ocean blocks port 587 is a [terrible, uninformed decision](https://x.com/Supermathie/status/1912932253069410345?t=ffbIjKxYgzHlP6oPYdlrcw&s=19) with no basis in good practice.

I’m surprised they haven’t started to block 2525 by default for the same reason.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 7, 2025, 9:13pm UTC](https://meta.discourse.org/t/discourse-setup-doesnt-populate-discourse-smtp-domain/390624/8 "2025-12-07T21:13:23Z")

</div>

> [@supermathie](#):
>
> The fact that Digital Ocean blocks port 587 is a [terrible, uninformed decision](https://x.com/Supermathie/status/1912932253069410345?t=ffbIjKxYgzHlP6oPYdlrcw&s=19) with no basis in good practice.

I don’t disagree. I’m pretty sure that they aren’t the only ones who do it (but I’m having trouble backing that up). What’s strange is that they’ve always sort-of done that, but then last April (?) they enforced it for everyone. But “everyone” means something very much like “everyone after they reboot the next time” (it might hinge on something else that requires a reboot), so it could be months later before you rebooted (or resized your droplet or something) and then it started happening.

And they don’t even offer an SMTP service, so once they block 2525 there won’t be any way to send mail. I’ve got lots of people on DO since CDCK has been recommended them from the start (or at least when I started).

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [December 7, 2025, 9:23pm UTC](https://meta.discourse.org/t/discourse-setup-doesnt-populate-discourse-smtp-domain/390624/9 "2025-12-07T21:23:06Z")

</div>

> [@Ethsim2](#):
>
> this was because DO block port 587

How did you discover this? Did you try the `emails:test` rake task, and if you did was it useful? Did you know it existed?

---

<div class="post-metadata">

### Author: ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)
#### Post date: [December 7, 2025, 9:42pm UTC](https://meta.discourse.org/t/discourse-setup-doesnt-populate-discourse-smtp-domain/390624/10 "2025-12-07T21:42:58Z")

</div>

Thanks, Michael - here’s what actually happened on today’s install and how I worked out that port 587 was the root cause.

When I first ran ./discourse-doctor at [50:30](https://youtu.be/eGSKB8CKjao?t=3030), it clearly showed that outbound SMTP on 587 was failing. There were no successful test emails anywhere in that part of the process. Because of that, at [51:38](https://youtu.be/eGSKB8CKjao?t=3098) I changed the SMTP port to 2525 and rebuilt the container. As soon as the app came back up, the first mail test at [57:46](https://youtu.be/eGSKB8CKjao?t=3466) succeeded immediately.

At [57:58](https://youtu.be/eGSKB8CKjao?t=3478) I noted that my Mailgun account still hadn’t activated - so the doctor was correct in saying SMTP failure was not due to credentials, but to the port being blocked by DigitalOcean.

Since Brevo is quicker to get running, I switched providers: starting the setup at [58:40](https://youtu.be/eGSKB8CKjao?t=3520), selected the Free plan at [1:01:12](https://youtu.be/eGSKB8CKjao?t=3672), swapped the DNS records at [1:02:29](https://youtu.be/eGSKB8CKjao?t=3749), and updated the SMTP settings in app.yml at [1:04:37](https://youtu.be/eGSKB8CKjao?t=3877). At [1:06:08](https://youtu.be/eGSKB8CKjao?t=3968) I pointed out that the GUI displays DISCOURSE\_SMTP\_DOMAIN even when the variable isn’t populated by ./discourse-setup, which is why the blank field initially made me think something was misconfigured.

After finishing the Brevo configuration, I reran ./discourse-doctor at [1:42:10](https://youtu.be/eGSKB8CKjao?t=5530), and at [1:42:25](https://youtu.be/eGSKB8CKjao?t=5545) it confirmed a successful outbound email - again using port 2525.

To answer your specific questions:

- How did I discover DigitalOcean was blocking 587?  
./discourse-doctor reported 587 failing immediately, and switching to 2525 fixed it instantly. The video shows this sequence clearly.
- Did I use rake emails:test?  
Not at the time - I was relying on ./discourse-doctor and the admin UI test email. I didn’t realise emails:test existed until you mentioned it. I’ll absolutely use it going forward since it gives clearer in-container diagnostics.
- Was the missing DISCOURSE\_SMTP\_DOMAIN related?  
No - the blank GUI field was a red herring. The actual issue was DigitalOcean blocking port 587; once I moved to 2525, both Mailgun (once activated) and Brevo worked fine.

Thanks again - your explanation of what DISCOURSE\_SMTP\_DOMAIN actually affects (EHLO only) helped clear up why the missing value didn’t matter.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [January 6, 2026, 9:43pm UTC](https://meta.discourse.org/t/discourse-setup-doesnt-populate-discourse-smtp-domain/390624/11 "2026-01-06T21:43:18Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
