Newsletters 0.4.0: Broadcast layouts of its own and emails in each reader's language
Newsletters 0.4.0 gives the PhoenixKit newsletters module its own broadcast layouts, edited per language, and sends each email in its reader’s language: the layout, the subject and the site’s header and footer.
Layouts
A new Layouts page lists the HTML your broadcasts are sent inside. You can create and edit layouts, archive and restore them, and pick one with Make default as the starting point for new broadcasts, or switch back with Use the standard layout by default. Archiving a layout does not take it away from broadcasts that already use it.
The layout editor has one tab per language, each with its HTML, an optional Subject pattern and a plain-text version kept for reference, plus a Preview. A layout places the broadcast with {{{content}}} and can use {{{header}}}, {{{footer}}}, {{logo_url}}, {{accent_color}}, {{site_name}}, {{site_url}} and {{subject}}. A broadcast without a layout is wrapped in core’s standard email layout.
Until now broadcasts used core’s email templates as their wrapper. The upgrade copies the templates you wrote into the new layouts table, plus any system email a broadcast or the default setting still points at, kept archived. It runs once, and a name that clashes gets a unique suffix.
Each email in the reader’s language
Each email is now rendered in the reader’s language: a user’s preferred language, a CRM contact’s or its list’s language, and otherwise the site’s. That language picks the layout’s translation, its subject pattern and core’s header and footer. The broadcast editor can preview the email in any site language.
A subject never keeps line breaks, and a layout’s subject pattern applies only when that language’s HTML actually places the body.
Fixes
Saving a layout with a malformed translation is now refused instead of losing the value, and the editor clears a field’s error once it is fixed.
Upgrading
Newsletters 0.4 needs phoenix_kit ~> 2.52 (up from ~> 2.0) and phoenix_kit_templates ~> 0.2.2. Run mix phoenix_kit.update: the module’s migration V2 creates the layouts table, copies your templates into it and points broadcasts at it. Check the new Layouts page afterwards and choose a default.
Full release notes: Newsletters 0.4.0
0.4.0 · 4 October 2026
Added
- Module-owned broadcast layouts. Migration V2 creates
phoenix_kit_newsletters_layoutsand copies the operator-authored rows of core’sphoenix_kit_email_templatesinto it under their own uuids (plus any system email a broadcast or the default setting still points at, archived).broadcasts.template_uuidbecomes a foreign key to the new table. The import runs once per install and gives a colliding name a unique suffix instead of aborting. New Layouts admin pages (list, archive/restore, default layout, per-language editor with preview). (#37) - Per-recipient language. Each email is rendered in the reader’s language
(user locale, CRM contact or list locale, else the site’s): the layout’s
translation, its subject pattern and core’s header/footer. A layout places
the broadcast with
{{{content}}}and can use{{{header}}},{{{footer}}},{{logo_url}},{{accent_color}},{{site_name}},{{site_url}}and{{subject}}. A broadcast without a layout is wrapped in core’s standard layout. The broadcast editor previews in any site language. (#37)
Changed
- Requires
phoenix_kit ~> 2.52(was~> 2.0) and declaresphoenix_kit_templates ~> 0.2.2. Core 2.52 no longer auditsfk_newsletters_broadcasts_template, which V2 re-targets, somix phoenix_kit.doctorandrepairstay clean. - A subject always loses line breaks, and a layout’s subject pattern applies only when its HTML translation places the body.
Fixed
- Layout changes reject malformed translation values instead of silently dropping them; the layout editor clears an error once its field is fixed.
- The warning for a layout without
{{{content}}}keeps one cache entry per layout instead of one per edit.
Newsletters 0.4.0. Install or update: {:phoenix_kit_newsletters, "~> 0.4"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.