Central new install: Unable to login after shifting to custom email server

1. What is the issue? Please be detailed.
I am trying to set up ODK, with ODK Central on a self-hosted instance on Digital Ocean following the docs. I am new to this, so am still learning.

Following the steps in the instructions, I have been able to install Central to the point where it loads on the subdomain we have created, and I am able to login as the admin. Adding new users didn't work, and, seeing the tip in the docs and reading many posts recommending the same on this forum, I decided to move us to a custom email serivce from Mailjet. All configuration on Mailjet appears to be all set, a sender email address on our custom company domain has been validated (SPF, DKIM) and the status says "Active".

As soon as I make this move following the instructions to the best of my understanding, my login to Central stopped working (the page still loads).

When I enter my login credentials, the error popup, in red, is: "Something went wrong: error code 502."

Could anyone spot what I am doing wrong?

2. What steps can we take to reproduce this issue?
Not sure. A fresh install of Central on Digital Ocean droplet following the instructions?

3. What have you tried to fix the issue?
Not knowing exactly what's wrong, I rebuilt the droplet and did a fresh install of everything upto the creating users and logging into Central step, and set up the Mailjet custom email service again. And I ran into the same problem: my login worked at first, but after setting up the Mailjet service, the same error started appearing.

4. Upload any forms or screenshots you can share publicly below.
Below is a screenshot of the part of my .env for setting up the Mailjet email server.

I found it hard to follow the instructions in the docs for appropriately editing .env. I followed Mailjet's docs here and here to arrive at these entries. The EMAIL_USER and EMAIL_PASSWORD are our Mailjet account's API key and secret key respectively. Should I be setting the EMAIL_FROM to anything (the docs don't mention it)?



Welcome to the ODK forum, @pklgeez! We're glad you're here. When you get a chance, please introduce yourself on this forum thread. I'd also encourage you to add a picture as your avatar because it helps build community!

Thanks for spending some time searching the forum to see if your problem has already been solved on another thread! Have you tried looking at your docker logs with docker-compose logs service and docker-compose logs mail to see if there are any hints as to what is wrong? I'm sorry I'm not of more help.

1 Like

Upon your suggestion @danbjoseph, I looked up the logs in the two ways you mentioned. I don't see any hints on what might be wrong, although I might be missing things since I've not done this before. Here are screenshots: all of it for docker compose logs service, and the last few lines of docker compose logs mail:

I did try testing our Mailjet end of things though: a test transactional email I sent from our dashboard there was successful, it arrived in the intended inbox. So it seems like the issue is in our settings in our Central and how that sets up the plumbing with Mailjet while adding it as a custom email service?

Its was the same for me, after performing:
docker compose build service && docker compose stop service && docker compose up -d service

=>The solution was stopping everything with:
sudo docker compose stop
=>The start with:
sudo docker compose up -d

=>Mail Server Settings:


Thank you @Langen_Mathew, I will try the complete stop and start you suggest.

But before I try that, some clarifications about my settings:

Looking at these makes me suspect may I have my settings wrong as I shared in a screenshot in my note at the start.

  • I have my EMAIL_USER and EMAIL_PASSWORD set to our Maijet account's API key and secret key respectively.
    • Should I change EMAIL_USER to one I have configured on our Mailjet account as a sender email id (from our custom domain)?
    • And should EMAIL_PASSWORD be that email's password (and not anything on our Mailjet account)?
  • Should I have EMAIL_HOST to be Mailjet's SMTP hostname (as given in their docs), or something else (our company domain is a Google Workspace domain, in case that's relevant)?
  • Should I shift to EMAIL_PORT=465 and EMAIL_SECURE=true?
1 Like

The complete stop and start you suggest fixed the issue, thanks @Langen_Mathew!

And, to clarify my own doubts, I did not have to change my settings. Except, I had to uncomment the EMAIL_FROM line and make sure it is set to the email id configured as a sender id on our Mailjet account. Without that, I received a "A non-validated sender address was used" because Central apparently tried to send from a default no-reply@[our domain].com which does not exist.


Thanks for sharing the solution, @pklgeez. I've added a hint about sender addresses to the docs and also confirmed the docs require a build/stop/up as @Langen_Mathew noted.

1 Like