For setting up a local SMTP server on the same machine as the Discourse container, Discourse does not specify exactly what the correct values for the SMTP settings in app.yml should be. This leads to a great deal of confusion and errors.
In the app.yml settings, Discourse does not clearly specify what the DISCOURSE_SMTP_ADDRESS is supposed to be.
In reality it is subdomain.domain.com, and not mail.subdomain.domain.com
Correct values:
DISCOURSE_SMTP_ADDRESS: forum.domain.com
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: postmaster@forum.domain.com
DISCOURSE_SMTP_PASSWORD: "password"
DISCOURSE_SMTP_ENABLE_START_TLS: true # (optional, default true)
Discourse does not clearly specify what the “server certificate” is in this error statement that is present after sending the initial registration email fails. The error message is located in:
/discourse/shared/standalone/log/rails/production.log
“Job exception: hostname “mail.forum.domain.com” does not match the server certificate”.
However, in reality, the “server certificate” is simply the server’s ssl certificate.
Also, in the error message, Discourse incorrectly mentions “hostname”, when instead what is being referred to in reality is actually the DISCOURSE_SMTP_ADDRESS.
There was struggle because of Discourse’s ambiguity.
The solution was simply to set the server’s ssl certificate to the correct ssl certificate.
When the problem was posted to the Discourse forum, there were a lot of misleading and unclear answers.
Discourse should fix these problems.