如何在 Sendgrid Swift SmtpTransport 中进行 SUBJECT 替换? [英] How to make SUBJECT Substitutions in Sendgrid Swift SmtpTransport?
本文介绍了如何在 Sendgrid Swift SmtpTransport 中进行 SUBJECT 替换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 Swift SmtpTransport,因为它似乎是推荐的方式.
I am using Swift SmtpTransport as it seems to be the recommended way.
然而,我发现的文档并没有展示如何实现主题替换.
However the documentation I found dos not show how to achieve Subject Substitutions.
- (这是我正在使用的)https://github.com/sendgrid/sendgrid-php-example/blob/master/smtp-php-example.php
- https://github.com/sendgrid/sendgrid-php
- http://swiftmailer.org/docs/发送.html#quick-reference-for-sending-a-message
推荐答案
This was answers on Github,也在这里回答,供大家日后参考.
This was answered on Github, answering here too, for folks future reference.
要使用 SMTPAPI 替换主题,您需要在电子邮件的主题中添加替换标签,然后包含定义了替换标签的 x-smtpapi
标头.
To use the SMTPAPI to substitute for subjects, you'll need substitution tags in the subject of the email and then include the x-smtpapi
header with substitution tags defined.
<?php
...
$message->setSubject('[sendgrid-php-example] Owl named %yourname%');
$header = new Smtpapi\Header();
$header->addSubstitution("%yourname%", array("Mr. Owl"))->
...
这篇关于如何在 Sendgrid Swift SmtpTransport 中进行 SUBJECT 替换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文