主题行中的Symfony Mailer Twig上下文
我使用的是Symfony 5和带有TWIG模板的Mailer组件。上下文适用于电子邮件的正文,但是是否没有办法将其应用于电子邮件主题行?
现在,我必须手动执行自己的字符串替换,我简直不敢相信这在同一消息上下文中不可能。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
电子邮件的主题不是树枝模板,因此它不会从模板上下文中插值任何变量。
在创建实际的电子邮件并设置电子邮件主题时,您需要进行自己的插值。
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.