Home > Mobile >  Symfony Mailer Twig Context in Subject Line
Symfony Mailer Twig Context in Subject Line

Time:05-04

I am using Symfony 5 and the mailer component with twig templating. The context works fine for the body of the email, but is there not a way to apply that to the email subject line also?

Right now I'm having to manually do my own string replace, which I just can't believe this isn't possible within the same message context.

CodePudding user response:

The subject of the email is not a Twig template, so it won't interpolate any variables from the template context.

You'll need to do your own interpolation when creating the actual email message and setting an email subject.

  • Related