Latest version of Discourse not sending Email

I seem to be having a problem with Discourse sending emails over SMTP.

I have verified my hostname with my Email Service Provider and have successfully sent emails with Telnet and via sendmail via the host VM as well as via Telnet within the Discourse Docker container.

I had a look at integrating ‘sendmail’ within the Docker container and received a ‘host name could not be resolved’ error when emailing directly from the CLI.

To me this means that there are no issues with communication between the VM and the SMTP service provider.

I have tried all the usual SMTP ports and I believe that the configuration in the app.yml file is correct. The VM is Linux 20.04, 24.04 and 22.04 have been used in tests also.

Encryption is with a Let’s Encrypt certificate.

  DISCOURSE_SMTP_ADDRESS: <smtp_provider>
  DISCOURSE_SMTP_PORT:  <port>
  DISCOURSE_SMTP_AUTHENTICATION: login
  DISCOURSE_SMTP_USER_NAME: apikey
  DISCOURSE_SMTP_PASSWORD: "<secret>"
  DISCOURSE_SMTP_ENABLE_START_TLS: true

Whenever I send via the discourse form I keep getting an execution expired message.

1 Like

Check your email service provider’s limits. Sometimes the sending fails when the quota is reached. Try sending an e-mail from Outlook. It happened to me once. Your problem may be different, but it may still be useful to someone.

1 Like

If you’re getting “hostname could not be resolved” it sounds like the hostname cannot be resolved, which is a problem.

Does rake emails:test[you@somewhere.com] work? See also Troubleshoot email on a new Discourse install

2 Likes

Thanks for the responses. I has a look over the weekend. I created a VM on Digital Ocean and set up SMTP with Brevo. Everything was okay. :slight_smile:

So nothing wrong with Discourse.

I figure Discourse uses a Ruby GEM such as NET::smtp to mail and that by default there is no smtp server installed within the container. The issue we are facing is on an Azure tenant.

To me it feels like the request to the external SMTP service i.e. being blocked somewhere. By some kind of anti-SPAM mechanism sitting on top of the tenant.

I have a few more tests to carry out to narrow this down.

Any info on how Discourse facilitates email sending would be great :slight_smile: I am a bit of a newcomer to Ruby on the Rails.

1 Like

But you configured SMTP the same way that you did on the Digital Ocean instance?

What happens when you run the rake task?

Same: no connection.

I am using different SMTP relays in each instance.

There are a couple of tests I am running to validate:

  • Install discourse via docker-compose locally
  • Install Discourse in a different Azure tenant under a different subscription
  • Validate both Brevo and SendGrid smtp relays

I will update the post after these tests…

No connection is no connection. It’s pretty clear that you’re being firewalled.

Maybe try port 2525? Or ask if your desired port is being blocked by your provider (e.g., digital ocean).

@pfaffman Thanks for having some time for this. As it transpired the issue was DNS related.

Everything now working correctly :grinning:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.