Skip to content

[WIP] Send staging email through the local mail server - #2916

Open
Chrystinne wants to merge 1 commit into
devfrom
cf/staging-email-localhost
Open

Chrystinne wants to merge 1 commit into
devfrom
cf/staging-email-localhost

Conversation

@Chrystinne

Copy link
Copy Markdown
Contributor

Registration on staging currently hangs until nginx returns a 504. The account is created, but no activation email is sent.

Cause

  • Staging's settings send email directly to an external mail relay, which is currently unreachable from the staging server.
  • No EMAIL_TIMEOUT is set, so send_mail waits indefinitely and the request is cut off by nginx.

Changes

  • settings/staging.py: EMAIL_HOST = 'localhost', as in production. Staging already runs a local mail server, so Django hands the message over immediately and the local server takes care of delivery.
  • settings/base.py: EMAIL_TIMEOUT (default 10 seconds, configurable in .env), so an unreachable SMTP server fails the send after 10 seconds instead of blocking the request.

Not fixed here

  • Delivery from staging still depends on the relay being reachable again. Until then, messages wait in the local mail queue instead of blocking requests.

Testing

  • manage.py check passes and the settings load with EMAIL_TIMEOUT = 10.
  • Opening an SMTP connection to an address that never answers fails after 10.2 seconds with the timeout, and is still waiting after 40 seconds without it.

@Chrystinne Chrystinne changed the title Send staging email through the local mail server [WIP] Send staging email through the local mail server Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant