Emails 0.5.3: Exported templates keep only the message, not the old layout
Emails 0.5.3 changes what mix phoenix_kit_emails.templates.export writes: by default only the body of each email, so a template moved from the database into a file uses PhoenixKit’s current email layout instead of carrying its old one forever.
PhoenixKit wraps an email built from a file in its own layout, but never wraps a whole HTML document. An exported template that was a full document kept its old header, footer and styles for good. The task now has an --html option: body keeps what sits between the template’s header and footer, inlines the styles the body needs, and reports any decorative text it removed; document writes the whole document as before. The default, auto, picks body when the installed PhoenixKit has the layout and document when it does not.
Only sites that export templates are affected; sending is unchanged.
Full release notes: Emails 0.5.3
0.5.3 · 1 October 2026
Added
- Template export writes the body fragment, not the whole document
(PR #42). Core wraps an email built from a file in
PhoenixKit.Email.Layoutbut never wraps a whole document, so an exported document kept its old header, footer and<style>for good.mix phoenix_kit_emails.templates.exportnow takes--html auto|body|document(defaultauto:bodywhere the loaded core has the layout,documentwhere it does not).bodykeeps what sits between the template’s.headerand.footer, inlines the styles the body needs, keeps a title header and a footer carrying a placeholder as content, and reports whatever decorative text it removed.TemplateExport.Body.extract/1does the cutting.
Fixed
- The body cut read an unquoted attribute value ending in
/(<a href=https://x.com/>) as a self-closing tag: the header/footer pair was then judged “not siblings”, the export fell back to the whole<body>, and the URL lost its slash when a style was inlined. - The
Bodydocs claimed indentation tidying was skipped only inside<pre>/<textarea>; it is skipped for the whole block that contains one.
Emails 0.5.3. Install or update: {:phoenix_kit_emails, "~> 0.5"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.