1. What is the issue? Please be detailed.
I just did a new ODK Central fresh installation in Digital Ocean and the emails are not being sent to users while creating new accounts.
There is a message on the screen saying "Something went wrong: error code 504" and after using the docker compose logs --tail 50 service command I found a Connection timeout error:
service-1 | Error: Connection timeout
service-1 | at SMTPConnection._formatError (/usr/odk/node_modules/nodemailer/lib/smtp-connection/index.js:798:19)
service-1 | at SMTPConnection._onError (/usr/odk/node_modules/nodemailer/lib/smtp-connection/index.js:784:20)
service-1 | at Timeout. (/usr/odk/node_modules/nodemailer/lib/smtp-connection/index.js:237:22)
service-1 | at listOnTimeout (node:internal/timers:594:17)
service-1 | at process.processTimers (node:internal/timers:529:7) {
service-1 | code: 'ETIMEDOUT',
service-1 | command: 'CONN'
service-1 | }
I'm using a custom mail server configuration following the documentation and it's pointing to a Mailgun service account with a valid domain and authentication credentials (those setting are correct and still working on another old ODK Central installation that I'm running at Digital Ocean).
2. What steps can we take to reproduce this issue?
It's happening to any new installation of ODK Central in Digital Ocean. I did it 2 times and got the same end result.
3. What have you tried to fix the issue?
Yes, and I'm kind a following up here what I've found:
That's good to know about the change from Digital Ocean! We can add that to the docs.
When using an external mail service like Mailgun, you shouldn't need the SMTP port to be open. Did you do a docker compose stop && docker compose up -d after changing your settings? A rebuild shouldn't be necessary but a stop and restart is.
I did stop, rebuild and restart the Service container and all other Central containers couple of times. I'm setting up this droplet and have no production data on it yet, so no worries about rebuilding everything.
It's still not working (timeout error) for sending messages even using the command line app that I've mentioned and I can ping the Mailgun relay servers (smtp.mailgun.org) from my droplet. It's weird.
The support team at DigitalOcean oriented me to use Sendgrid service as their solution and I created and configured an account and API authentication credentials there. But so far I've got zero progress, same connection timeout error now with smtp.sendgrid.net.
The support team at Digital Ocean removed the SMTP restriction on their firewalls for my account and now emails are sent as expected by ODK Central.
They were filtering packets by protocol, so I could reach the smtp servers at Sendgrid, Mailjet and Mailgun using ping (yes, I have configured accounts on all three ) but not relay email through them.
If anyone get into this issue I strongly suggest to create a ticket to the Digital Ocean support team right away.
I'm glad you got it working and sorry about the trouble!
Ah yes, I forgot that when these external services are configured they're currently used as relays, thanks. We'll update docs for now and see if we can introduce native support for at least Mailgun.
Recently, I deployed an ODK Central instance over DigitalOcean and yes - the SMTP ports 25, 465 and 587 were blocked by the DigitalOcean. I am using SendGrid as my mail server and I learned that SendGrid offers this special port - 2525(TLS) to bypass SMTP restrictions on places like DigitalOcean. So, I used the same and it's working as of now with no issues.
Hmm, I shall update it here in case it stops working in the future.
I tried with all three - 25, 465, 587, none worked. But, 2525 worked randomly (tested it so far by sending 3 reset password mails to myself and 5 new user mails).