Problem Sending Activation Email

AI-generated summary

Problem Sending Activation Email

nparab is experiencing issues with sending activation emails on their Discourse installation. The error Net::ReadTimeout occurs when using port 465, and switching to port 587 resolves the issue but reveals a hostname "mail.mydomain.com" does not match the server certificate error. To resolve this, nparab sets DISCOURSE_SMTP_ENABLE_START_TLS to false in the app.yaml file.

However, Johani notes that the one-click DigitalOcean installation is not officially supported, and recommends following the official installation guide.

nparab investigates the certificate mismatch issue, finding that the mail server returns a certificate for mydomain.com instead of mail.mydomain.com. They resolve the issue by configuring Discourse to use mydomain.com as the DISCOURSE_SMTP_ADDRESS.

I have installed Discourse using the 1-click app install on DigitalOcean with LetsEncrypt HTTPS support. I’m not receiving the activation email on my admin email account. When I run ./discourse-doctor, on the Email Send step I get the following error:

Net::ReadTimeout

I am hosting Discourse on a sub-domain, while my main site (main domain) & mail server are on Hostgator. The SPF and DKIM records are active on my main domain. I have configured Discourse mail send for the port 465, which is what my Hostgator mail servers support.

Could anyone shed some light on what could be going wrong?

Thanks in advance.

Edit: When I try port 587 ./discourse-doctor gives a different error given below:

Sending mail failed.

Update: I got the activation email working using the port 587 and using the following value in app.yaml file:

DISCOURSE_SMTP_ENABLE_START_TLS: false

Once I logged into the admin interface I could see the following Sidekiq errors (from before?):

Jobs::HandledExceptionWrapper: Wrapped OpenSSL::SSL::SSLError: hostname “mail.mydomain.com” does not match the server certificate

Now, I understand that this error went away because I set the DISCOURSE_SMTP_ENABLE_START_TLS to false, but is this the right way to do things?

Hi and welcome to meta @nparab :wave:

I’m afraid we can’t support the one-click install offered by DigitalOcean because it’s not the officially endorsed way to set up Discourse. I strongly recommend that you follow our official installation guide.

That message is self explanatory and means that your mail server is misconfigured.

But if I connect via this command:

openssl s_client -starttls smtp -crlf -connect mail.mydomain.com:587

it connects properly and I can even send emails. If the mail server was misconfigured then this command also shouldn’t work, right?

Update: On executing this command:

openssl s_client -servername mail.mydomain.com -starttls smtp -crlf -connect mail.mydomain.com:587

it returns a certificate for mydomain.com instead of the certificate for mail.mydomain.com.

Is this the misconfiguration you were talking about?

For the moment, I have configured Discourse to use this mydomain.com (instead of mail.mydomain.com) as the DISCOURSE_SMTP_ADDRESS in the app.yml file, so that the certificates match. Will this cause any problems?