Custom mail templates

Customizing Sylius Email Templates for Frontend Links

eBy default, Sylius 2.0 email templates generate backend URLs (e.g. /admin/...) that don't make sense for a headless frontend setup like FrontWing. To fix this, you need to override the Twig templates and point them to the correct frontend routes.

This page shows examples for 3 templates, but the approach is identical for others (shipping updates, invoice, newsletter, etc.).

circle-info

Important: In the examples below, we use http://localhost:5173 — make sure to replace this with your actual frontend domain in production (e.g. https://front-wing.sylius.com).

Account Verification Email

File to override:

Example content:

Password Reset Email

File to override:

Example content:

Order Confirmation Email

File to override:

Example content:

🛠 Tips

  • Replace all hardcoded URLs with your own domain.

  • Use inline styles for better email client compatibility.

  • You can customize any email Sylius sends — just look in the /views/Email/ folder and follow the same pattern.


Local email testing

During development, it's important to test email templates locally. Sylius uses the configured mailer transport from .env or .env.local.

To use MailHogarrow-up-right:

  1. Install and run MailHog (e.g. via Docker or Homebrew).

  2. Update your .env.local in the Sylius backend:

  1. Start your server and open http://localhost:8025arrow-up-right to view sent emails.

You can also use other tools like Mailtrap or Symfony Mailer’s file transport.

Last updated

Was this helpful?