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`.
Create a send-only key
In Unitpost, open Settings → SMTP and create a send-only key, then verify the domain your notification address uses.
Edit containers/app.yml
Under
env:, set the SMTP keys. Discourse uses STARTTLS by default, so port 587 needs nothing more. For port 465, setDISCOURSE_SMTP_PORT: 465andDISCOURSE_SMTP_FORCE_TLS: true; Discourse turns STARTTLS off by itself when implicit TLS is forced.YAMLenv: # ...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.comKeep the password in quotes: the sample file warns that a
#in an unquoted value can be misread.Rebuild the container
Changes to
app.ymlonly apply after a rebuild, which takes the forum offline while it runs.Shellcd /var/discourse ./launcher rebuild appSend 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-doctorchecks the mail configuration too.If the test fails
A
Net::ReadTimeouton port 465 usually meansDISCOURSE_SMTP_FORCE_TLSis missing.535 5.7.8meansDISCOURSE_SMTP_USER_NAMEisn'tunitpost.550 5.7.1means the From domain isn't verified.