Allow for authless mail sending

Open Beginner friendly
#2,295 4 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
javascript, node.js

Research direction

Start with the EMAIL_USER and EMAIL_PASSWORD entries in docker-compose.yml, then trace how the app passes those settings to Nodemailer. The issue suggests omitting the variables when unset, and notes the auth object may need adjustment if that does not work. Done when an internal SMTP relay can send notifications without authentication and creating a user account no longer returns a 500 error.

Written by the indexing model from the issue text.

Description

From https://forum.getodk.org/t/custom-email-without-authentication/58724:

Unable to send email notifications using an internal SMTP relay without authentication. It seems ODK Central config requires username/password in the custom email configuration, but this results in an error 500 when creating a user account.

We use Nodemailer, and its [documentation](https://nodemailer.com/smtp#authentication) says:

If you omit the auth object entirely, Nodemailer attempts to send without authentication. This works only with servers that allow unauthenticated sending (typically internal relay servers).

My guess is that instead of omitting Nodemailer's auth object when EMAIL_USER and EMAIL_PASSWORD aren't set, we're including it with empty strings for user and pass.

One quick thing to test would be changing docker-compose.yml to omit the variables when they're unset by removing ${EMAIL_USER:-} and ${EMAIL_PASSWORD:-}:

- EMAIL_USER
- EMAIL_PASSWORD

If that doesn't work, we may need to change how we construct the Nodemailer auth object.

Dominant language
JavaScript
Stars
233
Forks
241
Avg merge
1d 22h
Merged PRs (30d)
13

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getodk/central

All issues in getodk/central

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.