Skip to content

feat: add EMAIL_TLS_REJECT_UNAUTHORIZED env variable to support self-signed SMTP certificates #605

Description

@matt-rgx

Is your feature request related to a problem? Maybe it would be better as discussion? Please describe.

When self-hosting SplitPro behind a local SMTP relay that uses a self-signed certificate (e.g., ProtonMail Bridge),
the magic-link email fails with Error: self-signed certificate. This is because rejectUnauthorized in mailer.ts is
hardcoded to true in production with no way to override it via environment variable.

Describe the solution you'd like

Add an environment variable — e.g. EMAIL_TLS_REJECT_UNAUTHORIZED (default: true) — that controls the
rejectUnauthorized option passed to the nodemailer transport:

tls: { rejectUnauthorized: env.EMAIL_TLS_REJECT_UNAUTHORIZED !== 'false' }

This would allow self-hosters using local SMTP relays with self-signed certificates to disable certificate
verification explicitly.

Describe alternatives you've considered

  • Setting NODE_ENV=development at runtime — ineffective because NODE_ENV is baked into the compiled Next.js bundle at
    build time, not read at runtime.
  • Patching the compiled chunks with sed in a custom Docker image — works but breaks on every update and is not a
    maintainable solution.
  • Using an OAuth provider (Google, OIDC) to bypass SMTP for auth — not always viable for self-hosters who want a fully
    local setup with no external dependencies.

App version

Latest (ossapps/splitpro:latest — pulled 2026-04-07)

Additional context

This affects any self-hoster using a local SMTP relay with a self-signed certificate (ProtonMail Bridge, local
Postfix, etc.). The fix is minimal — one env variable, one line change in mailer.ts.

Activity

  1. added this to the 2.1 milestone on Apr 12, 2026
  2. added theissue type on Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions