Hoppa till innehållet

Apps

Discourse

Send the mail that a self-hosted Discourse writes, such as notifications, sign-up codes and password resets, through Sendora’s SMTP. This guide is for a Discourse from the standard install, which keeps its settings in /var/discourse/containers/app.yml.

Before you start

  • A Sendora account. A test server works from the moment the account exists. A live server sends once your account is approved. The account starts on Free, within the limits that Account › Usage in the dashboard shows.
  • Access to the DNS of the domain that Discourse’s mail comes from.
  • Root access to the machine that runs Discourse, and an admin’s account in Discourse.

Set up Discourse

  1. Add the domain that Discourse’s mail comes from under Domains, and add the two DNS records it shows, as Domains explains.
  2. Create a test server under Servers › New server, with Testserver ticked, and create a key on its API keys tab. The key starts with sk_test_. A test server takes mail as a live server does and delivers none of it.
  3. In the env section of /var/discourse/containers/app.yml, set these lines, with the server key as both user name and password. They replace the DISCOURSE_SMTP_ lines that the install wrote.
env:
  DISCOURSE_SMTP_ADDRESS: smtp.sendora.se
  DISCOURSE_SMTP_PORT: 465
  DISCOURSE_SMTP_FORCE_TLS: true
  DISCOURSE_SMTP_USER_NAME: sk_test_…
  DISCOURSE_SMTP_PASSWORD: sk_test_…
  DISCOURSE_NOTIFICATION_EMAIL: noreply@example.se

Put an address on your verified domain in DISCOURSE_NOTIFICATION_EMAIL. Discourse sends its mail from it.

Port 465 encrypts the connection from the first byte, and DISCOURSE_SMTP_FORCE_TLS tells Discourse to do so. Without it, Discourse waits on port 465 for a greeting that never comes, and its test email fails. ./discourse-setup asks for the other values but not for this one, so add it to the file yourself.

Port 587 works too, without DISCOURSE_SMTP_FORCE_TLS. Discourse then starts TLS only if the server offers it, as line 275 of its settings code shows in 2026.12.0-latest. If someone between Discourse and Sendora removed that offer, Discourse would send the key unencrypted, so use 465 where you can. If Discourse runs on a host that blocks ports 465 and 587, such as a DigitalOcean Droplet, use port 2525 as you would 587.

  1. In /var/discourse, run ./launcher rebuild app, which builds the container again with the new settings. The forum is offline for a few minutes while it rebuilds.
  2. In Discourse, open Admin, then Email settings under Email, and its Server settings tab. Enter your address beside Send test email, and click the button.
  3. Find the message on the server’s Messages tab under Servers.
  4. Once your account is approved, create a key on your live server’s API keys tab, such as the default server that signup made. Put it in DISCOURSE_SMTP_USER_NAME and DISCOURSE_SMTP_PASSWORD in place of the test key, and run ./launcher rebuild app again.

The Server settings tab shows the user name, so every admin of your Discourse can read the key there. When someone stops being an admin, create a new key and revoke the old one.

If a message is refused

Discourse treats a refused key and a refused message differently. If Sendora refuses the key, the test email shows ERROR - 535 5.7.8 Authentication credentials invalid. The rest of Discourse’s mail then fails in the background, and the log at /logs holds Job exception: with the same reply.

If Sendora refuses a message, Discourse skips it, and even the test email shows sent!. Open Email logs under Email, and its Skipped tab gives Sendora’s reply under Skip reason.

535 5.7.8 means the key is wrong or revoked. 550 5.7.1 means the From domain is not verified, or that a live server’s account is not yet approved. 451 4.7.0 means that a limit is reached, such as Free’s daily limit. 550 5.1.1 means the recipient’s address is on the suppression list, for example after a hard bounce. SMTP replies lists every reply.

Test the setup

On the server’s API keys tab under Servers, Test the setup shows each valid key’s latest sign-in and accepted message over SMTP. It also shows the key’s latest refusals, each with what to do. After Discourse sends a message, click Check now.