Skip to main content
Email is sent through Symfony Mailer, with templates rendered by Twig. Which transport is used depends on what an administrator configured.

Transports

The null transport is the default, which means a fresh installation silently drops mail until SMTP is configured. That’s deliberate: it keeps a half-configured installation from emailing real users. See Mailer settings and SMTP for the administrator side.

Sending

sendTemplate() takes one address or several, a template name, optional data and optional attachments. Every option is merged into the template data automatically, so templates can read option.site.name, brand settings and policy links without the caller passing them. The sender comes from option.mail.from.address and option.mail.from.name.

Templates

Templates live in resources/emails and are registered as the @emails Twig namespace. See Email templates for more details.

What triggers mail

Transactional mail is sent by event listeners rather than by request handlers: Because listeners run inside the request that dispatched the event, a slow or unreachable SMTP server slows that request down. Keep timeouts short, and prefer a nearby relay.

Sending from a plugin

Inject the service and render your own template through your namespace:
Extend the shared layout so your message matches the rest of the installation’s mail, and check how the template resolves in your installation before relying on a namespaced path.
Don’t send bulk mail through this path. It’s for transactional messages, sent one at a time, inside a request. Marketing sends belong in a dedicated platform; see Event-driven integrations.

Testing

  • Point SMTP at a local catcher, such as Mailpit or MailHog, while developing.
  • With the null transport, messages are logged rather than sent: check var/log/app-*.log.
  • Verify the “from” address is one your provider allows, or messages will be rejected or filtered.