Skip to content

Mail goes out through Fastmail, or to the terminal - #3

Merged
thalida merged 1 commit into
mainfrom
mail
Sep 5, 2026
Merged

thalida merged 1 commit into
mainfrom
mail

Conversation

@thalida

@thalida thalida commented Sep 5, 2026

Copy link
Copy Markdown
Owner

A magic link is the only way to sign in, so a deployment that cannot
send cannot be used. Fastmail carries it over SMTP on port 465, signed
in with an app password.

The toggle

EMAIL_USE_CONSOLE prints the mail instead of sending it, and beats a
configured host:

EMAIL_USE_CONSOLE=1 just dev    # this run prints sign-in links
just dev                        # default, mails for real

The local file now holds real credentials, so a developer needs a way to
stop a test sign-in reaching a real inbox without deleting them.

It is ours, not Django's, and it reads like Django's. defaults.py
defines it and email_backend beside it, and the email block in
settings.py says so, because the name alone cannot.

EMAIL_FROM

The variable behind DEFAULT_FROM_EMAIL is now EMAIL_FROM, so one file
has one prefix. The Django setting keeps its own name: Django reads it
for every message.

The deployment's .env moved with it, in the same change.

Tests pin the console branch

defaults.py loads .env.local on import. Without pinning, just test
on the host read the SMTP branch while CI, which mounts /dev/null over
that file, read the other one.

The inputs are pinned, not EMAIL_BACKEND. pytest-django swaps in locmem
on top, so mail.outbox still holds what was sent.

A defect this found

make-env.py rewrote a file line by line, so an answer to a prompt for a
key the file predated went nowhere. Every existing .env.local predates
the mail block, so the password would have been asked for and discarded.
bin/tests/test_make_env.py covers it, including the EMAIL_HOST and
EMAIL_HOST_USER prefix collision.

Checks

just check passes: 638 tests at 96.66%, ruff, the docs cross-check,
prose across 147 files, 21 bin/ tests, and no missing migration.

🤖 Generated with Claude Code

https://claude.ai/code/session_01X3FXXWHwTQ89ytonD2sZaT

A magic link is the only way in, so a deployment that cannot send
cannot be used. Fastmail carries it over SMTP on port 465, signed in
with an app password.

EMAIL_USE_CONSOLE prints instead, and beats a configured host. The
local file now holds real credentials, so a developer needs a way to
stop a test sign-in reaching a real inbox without deleting them.

The variable behind DEFAULT_FROM_EMAIL is EMAIL_FROM, so one file has
one prefix. The setting keeps Django's name, because Django reads it.

Tests pin the console branch. defaults.py loads .env.local on import,
so the host read the SMTP branch while CI, which has no file, read the
other one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X3FXXWHwTQ89ytonD2sZaT
@thalida
thalida merged commit 2549ce9 into main Sep 5, 2026
1 check passed
@thalida
thalida deleted the mail branch September 5, 2026 01:51
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