Skip to content

✨ Add EmailLayout layout component#21

Merged
damienlagae merged 2 commits into
mainfrom
feat/email-layout-component
May 28, 2026
Merged

✨ Add EmailLayout layout component#21
damienlagae merged 2 commits into
mainfrom
feat/email-layout-component

Conversation

@damienlagae
Copy link
Copy Markdown
Member

@damienlagae damienlagae commented May 28, 2026

Summary

  • Adds an EmailLayout component that replaces the abandoned @EnabelLayout/emails/base.html.twig from enabel/layout-bundle
  • Table-based, inline styles, 600px centered — the only layout every email client renders reliably (Outlook, Gmail, Apple Mail, etc.)
  • Renders the logo via Symfony Mailer's email.image() helper (CID-embedded inline)
  • Exposes a {% block content %} block for the email body
  • Configurable footer: address, no-reply notice (nullable), copyright year + holder

API

All optional with sensible defaults. Logo defaults to @images/enabel-logo-email.png (consumer registers the Twig namespace and ships the asset). copyrightYear resolves to date('Y') when omitted.

Test plan

  • PHPUnit: 216/216 (11 new tests: defaults, custom params, copyrightYear resolution, nullable logo/noreply, invalid types)
  • php-cs-fixer: clean
  • phpstan: no errors
  • Manual smoke test in a consumer app (Impala) — welcome / password-reset / text-only variants sent to Mailpit, HTML score 92-94%

Closes #17.

Closes #17.

Replaces the abandoned @EnabelLayout/emails/base.html.twig from
enabel/layout-bundle. Provides a table-based 600px-wide HTML email
layout with configurable header logo (via Symfony Mailer's
email.image() helper), Enabel footer (address, no-reply notice,
copyright) and a {% block content %} for the email body.
@damienlagae
Copy link
Copy Markdown
Member Author

Smoke-tested in Impala (consumer app) — symlinked the branch via composer path repo, sent 3 emails through Symfony Mailer to Mailpit.

What I verified

Variant Setup Result
welcome All defaults Logo CID-embedded, 600px white card, footer + no-reply notice + © 2026 Enabel. Mailpit HTML-check 93%
password reset noreply overridden (FR), copyrightHolder: 'Impala' Both overrides applied, © 2026 Impala. 92%
text-only logo: null, noreply: null, copyrightHolder: 'Impala' Header block hidden entirely, no-reply line dropped. 94%
  • email.image('@images/enabel-logo-email.png') correctly attaches the logo as inline CID (visible in Mailpit's "Inline image" indicator + bottom attachment panel)
  • copyrightYear resolves to current year via date('Y') when omitted
  • The {% component %} … {% block content %} … {% endcomponent %} pattern from the docs works as advertised; <tr><td> inside the block plugs into the outer table cleanly

Minor doc nitpick (optional)

The docs say to register '%kernel.project_dir%/public/images': images. In Impala this was already set up for unrelated reasons, but a new consumer pulling in only this component might miss it and hit a Unable to find template "@images/..." error from email.image(). The "Pre-requisite" section already mentions this — maybe just add an explicit note that the consumer must ship enabel-logo-email.png in public/images/ (the bundle doesn't carry the asset).

LGTM, ready to tag.

@damienlagae damienlagae merged commit 221e565 into main May 28, 2026
7 checks passed
@damienlagae damienlagae deleted the feat/email-layout-component branch May 28, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an EmailLayout component (replace abandoned enabel/layout-bundle email base)

1 participant