Skip to content

Make email templates runtime-configurable#34

Merged
dborovcanin merged 2 commits into
mainfrom
fix-templates
Jul 20, 2026
Merged

Make email templates runtime-configurable#34
dborovcanin merged 2 commits into
mainfrom
fix-templates

Conversation

@ianmuchyri

Copy link
Copy Markdown
Contributor

Summary

  • Verification, password reset, and invitation emails now render from a single .tmpl file each (Subject: + optional Content-Type: + body, minijinja {{ variable }} syntax) instead of hardcoded strings duplicated across identity/service.rs and tenants/email.rs.
  • Every template ships a built-in default baked into the image at /app/email-templates; setting ATOM_EMAIL_TEMPLATES_DIR (Compose wires this to a bind mount, defaulting to ./email-templates) lets an operator override any subset at runtime, without rebuilding — useful since Atom is embedded by multiple platforms/projects that each need their own branding.
  • Content-Type: text/html is optional per template (defaults to text/plain), so overrides can be full branded HTML.
  • Deduplicated the SMTP transport-building code that was previously copy-pasted across all three send functions into src/mail.rs.

Test plan

  • cargo test --lib (126 passed)
  • cargo fmt --check / cargo clippy --lib -- -D warnings clean
  • docker build --target release succeeds and /app/email-templates contains the three defaults
  • Verified end-to-end in the portal repo: built atom locally via docker-compose.local-build.yml, mounted branded HTML overrides via ATOM_EMAIL_TEMPLATES_HOST_DIR, confirmed the templates land readable inside the running container

Verification, password reset, and invitation emails now render from a
single .tmpl file each (Subject + optional Content-Type + body, using
minijinja) instead of hardcoded strings duplicated across three call
sites. Every template ships a built-in default baked into the image;
setting ATOM_EMAIL_TEMPLATES_DIR (Compose wires this to a bind mount)
lets an operator override any subset without rebuilding, since Atom is
embedded by multiple platforms/projects that each need their own
branding.
ATOM_EMAIL_TEMPLATES_HOST_DIR/ATOM_EMAIL_TEMPLATES_DIR had no entry here,
unlike the analogous ATOM_CERTS_CA_DIR pattern.
@dborovcanin
dborovcanin merged commit 51fc41f into main Jul 20, 2026
3 checks passed
@dborovcanin
dborovcanin deleted the fix-templates branch July 20, 2026 16:53
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.

2 participants