主题行中的Symfony Mailer Twig上下文

发布于 2025-01-25 17:08:05 字数 123 浏览 4 评论 0原文

我使用的是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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

顾忌 2025-02-01 17:08:05

电子邮件的主题不是树枝模板,因此它不会从模板上下文中插值任何变量。

在创建实际的电子邮件并设置电子邮件主题时,您需要进行自己的插值。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文