Repository navigation
feat: admin password reset, startup check and events for provider-template core emails - #30
Merged
Merged
Conversation
…plate core emails
Close the gaps of a review against Strapi RFC #27752 (provider-managed email
templates) for SendGrid and Mailgun:
- admin forgot password is the third core email (admin-forgot-password):
the @strapi/admin sendTemplatedEmail call is recognised and sent through the
chosen provider template with payload v1 { user, url, token, adminUrl,
serverUrl, meta }; strict by default, opt-in Strapi fallback; super admins
only
- startup check (non-blocking, after start) of every core-email template,
syncs a stale list, logs key and code, shown on the dashboard alert;
Mailgun templates without Subject header are flagged (NO_SUBJECT)
- events magic-mail.provider-template.failed / .fallback (key, code only)
- meta.strapiVersion (additive) and a one-time warning when url is empty
- SendGrid: a passed subject is copied into dynamic_template_data.subject
- test sends use sample data of every core email using the template
- docs: what a provider template replaces, Reply-To, Core emails hint
Docs read: @strapi/admin 5.63.0 services/auth.js forgotPassword and
@strapi/email 5.63.0 services/email.js (installed source); SendGrid
dynamic templates and Mail Send reference (dynamic_template_data fills
subject); Mailgun templates API (headers JSON, DELETE template).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions Bot
pushed a commit
that referenced
this pull request
Nov 19, 2026
# [4.10.0](v4.9.1...v4.10.0) (2026-11-19) ### Features * admin password reset, startup check and events for provider-template core emails ([#30](#30)) ([cf3ef8a](cf3ef8a))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR closes the gaps a strict review found between Magic Mail and Strapi RFC #27752 ("Provider-managed email templates"). It covers SendGrid and Mailgun. Brevo and SES behaviour is unchanged, apart from shared code that is tested.
Must
Admin forgot password via provider template. The new core type is
admin-forgot-password. ThesendTemplatedEmailshim recognises the call that@strapi/admin5.63 makes inservices/auth.jsforgotPassword, which passes{ url, user }withadmin.forgotPassword.emailTemplate. A call counts as that mail when the data holds exactlyurlanduser, and either the template is the configured object or the link is<admin.absoluteUrl>/auth/reset-password?code=. Payload v1 is{ user:{id,email,firstname,lastname,username}, url, token, adminUrl, serverUrl, meta:{templateKey,payloadVersion:1,coreEmailType,locale?,strapiVersion?} }:idandlocale(preferedLanguage) come from one best-effortadmin::userlookup. It runs only when a design is set.setCoreDesignreturns 403 to anyone else, andeditablehides the button.Boot-time validation. About 20 s after start (a timer, non-blocking),
checkCoreDesigns({ syncIfStale: true })runs:…_UNKNOWN,…_UNAVAILABLEand the new…_NO_SUBJECTfor Mailgun templates without a Subject header, see below), storescoreCheck, and exposesproblem,lastSyncedAt,checkedAtandeditableper design.CoreDesignAlertand the Core emails notice name each mail with its reason and the time of the last check.Integration tests against the fake providers (
tests/core-mails-integration.test.js):Units are in
tests/core-mails-units.test.jsand the admin UI checks intests/admin/strict-mode.test.jsx.Should
subjectis copied intodynamic_template_data.subjectwhen the data has nosubject(CR/LF stripped). The Twilio Mail Send reference saysdynamic_template_datafills the template's subject; the template must use{{subject}}. Documented indocs/sending.md.meta.strapiVersion(additive, frominfo.strapi). Whenurlcannot be built, a one-time warning per core type names the setting to fix.magic-mail.provider-template.failedand.fallbackwith{ key, code, coreEmailType, fallback? }. They follow the queueemitpattern (best effort, listener errors logged). They come fromprepareProviderTemplate,handleProviderTemplateFailureand the core designer fallback.usedByCoreMails.Additional finding (live)
The Mailgun live template
magic-mail-livehas no Subject header. Core emails do not pass the Strapi subject on, so such a template would always fail withMAGIC_MAIL_PROVIDER_TEMPLATE_NO_SUBJECT. Core designs on such templates are now reported as unusable: in the startup log, on the dashboard, with a badge, and with a warning in the design dialog. The send path itself is unchanged.Compatibility
GET /designer/core-designsreturns a third entry and new fields.subjectnow carriessubjectindynamic_template_data; templates without{{subject}}are unaffected.CHANGELOG.mdanddocs/sending.mdand were resolved by keeping both sides.Verification
npm test: 945 pass, 0 fail (3 skipped as before).npm run test:admin: 22 pass.npm run lintandnpm run format:checkare clean.npm run build,verify,verify:runtimeandnpm pack --dry-runall pass.LIVE_PROVIDERS=sendgrid,mailgun npm run test:live, after the rebase onto fix(mailgun): refuse deleted Mailgun templates before sending; no suppression for ESP blocks #29: 47 pass, 0 fail, 20 skipped (Brevo/SES not selected, no EU accounts). The newtests/live/core-mails.live.test.jscovers:{{subject}}was created by API, itssubjectvariable was detected after sync, a send was accepted withdynamic_template_data.subject, and the template was deleted afterwards (DELETE 204, then GET 404).o:testmode=yes): all three core emails through a synthetic domain template with a Subject header (created by API, deleted afterwards: DELETE 200, then GET 404) were accepted. With fix(mailgun): refuse deleted Mailgun templates before sending; no suppression for ESP blocks #29 the preflight template check runs live too.magic-mail-livetemplate (no Subject header) was flagged asNO_SUBJECT.page.routeand synthetic data:useRBAC, React Router future flag), blocked egress, and a 404 for an unmocked synthetic template detail.Checkbox.Docs read
@strapi/admin5.63.0services/auth.jsand@strapi/email5.63.0services/email.js(installed source);@strapi/coreinfo.strapi; SendGrid dynamic templates and Mail Send reference; Mailgun templates API (create withheadersJSON, DELETE template).🤖 Generated with Claude Code