Set up Discourse email over SMTP

Discourse uses outgoing mail to validate new accounts and to send notifications and digests. A standard install reads `DISCOURSE_SMTP_*` from `/var/discourse/containers/app.yml`, and the port defaults to 25 unless you set it. The From address defaults to `noreply@` plus your forum's hostname, so either verify that hostname or set `DISCOURSE_NOTIFICATION_EMAIL`.

Need an API key?

SMTP password is a Unitpost API key with emails:send. Username is always unitpost.

  • 5,000 emails/month
  • 3 API keys
  • 5 sending domains
Get free SMTP key
  1. Create a send-only key

    In Unitpost, open Settings → SMTP and create a send-only key, then verify the domain your notification address uses.

  2. Edit containers/app.yml

    Under env:, set the SMTP keys. Discourse uses STARTTLS by default, so port 587 needs nothing more. For port 465, set DISCOURSE_SMTP_PORT: 465 and DISCOURSE_SMTP_FORCE_TLS: true; Discourse turns STARTTLS off by itself when implicit TLS is forced.

    YAML
    env:
      # ...your existing keys
      DISCOURSE_SMTP_ADDRESS: smtp.unitpost.com
      DISCOURSE_SMTP_PORT: 587
      DISCOURSE_SMTP_USER_NAME: unitpost
      DISCOURSE_SMTP_PASSWORD: "pk_live_..."
      DISCOURSE_NOTIFICATION_EMAIL: noreply@yourdomain.com

    Keep the password in quotes: the sample file warns that a # in an unquoted value can be misread.

  3. Rebuild the container

    Changes to app.yml only apply after a rebuild, which takes the forum offline while it runs.

    Shell
    cd /var/discourse
    ./launcher rebuild app
  4. Send a test email

    In the admin panel, open Emails (/admin/email), enter your address in the test field and click Send test email. On the server, ./discourse-doctor checks the mail configuration too.

  5. If the test fails

    A Net::ReadTimeout on port 465 usually means DISCOURSE_SMTP_FORCE_TLS is missing. 535 5.7.8 means DISCOURSE_SMTP_USER_NAME isn't unitpost. 550 5.7.1 means the From domain isn't verified.

Search docs and guides

Search the docs and product guides.