Emails 0.5.0: Export your edited email templates to files
Emails 0.5.0 adds mix phoenix_kit_emails.templates.export, which copies the email templates you edited in the admin into files in your own app. Database templates are on their way out, and this is how your changes come along.
Why templates are moving
PhoenixKit email templates are moving from the database table into files that the host app keeps in its own repository, where they are under version control and can be reviewed. Nothing changes yet in this release: the database templates still win when an email is sent, and every edited template keeps working as today. A later release drops the table, and edits that have not been exported by then are lost.
The export task
Run the task from your app:
mix phoenix_kit_emails.templates.export
It writes files under priv/phoenix_kit_templates, and you review the changes and commit them. It deletes nothing and does not touch the database, so a wrong export costs only the files.
The task exports only what someone actually edited. A system template that is still exactly as the module ships it is skipped, because PhoenixKit core now supplies those defaults itself, translated into every language it ships. On a site where nobody opened the template editor, the task writes no files at all.
Templates that are not system templates, such as newsletter layouts picked per broadcast, are not exported. People who cannot open a pull request write those at run time, so they keep a table and an editor, and are set to move to the Newsletters module.
Options:
--dry-runshows what would be written.--out DIRwrites somewhere else.--forceoverwrites existing files. Without it, existing files are refused, so a re-run never replaces an override someone wrote by hand.
Upgrading
Update the dependency; there is no migration and nothing changes on a running site. If you have edited any email template, run the export and commit the result before you upgrade past this release. If you never edited a template, there is nothing to do.
Full release notes: Emails 0.5.0
0.5.0 · 6 September 2026
Added
-
mix phoenix_kit_emails.templates.export— the upgrade path off the templates table. Message templates are moving out ofphoenix_kit_email_templatesand into files a host owns in its own repository, where they are version-controlled and reviewable rather than edited through an admin UI. This task carries operator edits across:mix phoenix_kit_emails.templates.exportRun it, review the diff, commit the files. Nothing is deleted and no row is touched, so an export that turns out wrong costs nothing but the files.
It exports only what an operator actually edited. A system template still byte-identical to what this package ships is skipped — core supplies those itself now, translated into every shipped locale — so the diff you review contains your changes and nothing else. On an install that never opened the template editor, the task writes zero files.
Operator-authored templates (
is_system: false— newsletter layouts, picked per broadcast) are not exported. Those are authored at runtime by people who cannot open a pull request, so they keep a table and an editor; they move tophoenix_kit_newslettersrather than becoming files.Options:
--dry-runto preview,--out DIRto retarget,--forceto overwrite. Existing files are refused by default, so a re-run can never silently replace an override a human wrote. -
Templates.default_system_templates/0returns the shipped templates without writing them, which is how the export tells an untouched seed from an edit. -
PhoenixKit.Modules.Emails.TemplateExport— the classification and file layout as data, so the decisions are testable independently of Mix.
Deprecated
-
The email templates table is on its way out. Nothing changes yet: the database layer still wins at send time, and every customized template keeps working exactly as it does today. But a later release drops
phoenix_kit_email_templates, and edits that have not been exported to files will be lost at that point. If you have customized any email template, run the export task and commit the result before upgrading past this release.Hosts that never customized a template need do nothing.
Emails 0.5.0. Install or update: {:phoenix_kit_emails, "~> 0.5"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.