10-Feb-2026 — Mail,cloudflare and Mail: 2 features #82
Add automatic sending domain authentication that registers domains on
Brevo, provisions DKIM and verification TXT records via Cloudflare DNS,
and triggers Brevo domain verification. All operations are idempotent.
mail: Brevo email deliverability, template management, and sender workflow (#82)
#82 — Brevo Email Deliverability, Template Management, and Sender Workflow
Email signoff and merge field rendering fixes
- Fixed mail merge and sign-off rendering failures caused by Brevo's Froala editor silently reformatting merge field placeholders from
{{params.X.Y}} to {{ params.X.Y }} (with spaces), which broke exact string matching during template substitution.
- Added
sanitiseBrevoTemplate() pipeline that strips Froala editor attributes (fr-original-style, fr-original-class, contenteditable, data-placeholder, zero-width spaces), collapses nested placeholder spans, and normalises merge field spacing before substitution.
- Fixed
signoffNames() returning undefined when notification directive is not available — now returns empty string.
Brevo template baseline and sync
- Added clean, responsive local HTML email template baselines for core notification and account emails (forgot-password, membership-expiry, membership-expiry-warning, password-reset, ramblers-campaign, website-and-login-details, welcome-to-the-group).
- Templates use proper MSO conditionals, responsive media queries, and clean merge field placeholders.
- Local templates serve as seed sources for new environments — Brevo remains the authoritative editor for day-to-day template changes.
- Added reusable local template path and reader utilities to centralise template file handling.
Brevo template push, diff, and snapshot
- Added push-default-template endpoint to overwrite Brevo template content from local HTML files.
- Added template-diff endpoint to compare Brevo template content against local baselines.
- Added backend snapshot route to pull templates from Brevo into local baselines.
- Added template seeding support so environment setup and Brevo template population are aligned.
Brevo template editor and diff UX
- Replaced single Brevo edit button with dropdown offering Rich Text and HTML/Setup editor links.
- Added colour-coded badge indicating whether the Brevo template matches the local default.
Notification configuration validation
- Email configuration dropdown now shows issue count per config so administrators can quickly identify configs needing attention.
- Warning banner on selected config lists all detected issues.
- Brevo template and banner image selects highlight red when empty.
- Sender and reply-to role selects validate against actual committee roles with inline error display.
- Sign-off roles are individually validated with per-role warnings.
Send Emails UX improvements
- Improved member selection grouping with visible group counts in the Send Emails flow.
- Added Select All As Me in Sender, Replies and Sign-off to quickly set Sender, Reply To, and Sign-off roles to the logged-in user context.
- Improved role resolution for Select All As Me, including better handling of vacant roles and safer fallback role selection.
- Added defaults for missing member selection config values to avoid undefined month values.
- Improved grouped member badge styling and readability in member dropdown headers.
- Updated Brevo button and dropdown behaviour in mail settings for clearer interaction and state display.
Automatic template seeding for new environments
- Added migration that seeds local templates into Brevo for new environments, checking each template individually by name before creating.
- After seeding, automatically matches template IDs to notification configs by subject text (welcome-to-the-group maps to "Welcome to The Group", website-and-login-details maps to password reset and login configs, fully-automated-text-body is the default for all remaining configs).
- Eliminates the need to manually link template IDs to email configurations after environment setup.
Environment setup and deployment
- Added environment setup option to populate Brevo templates, defaulted to true when a Brevo API key is present.
- Kept this capability aligned for local development setup workflows while remaining safe for non-local environments.
- Backfilled existing data via migration so older configs behave consistently with new defaults.