在Sendgrid中使用节头

Zef*_*ryn 5 php sendgrid

我想在Zend应用程序中通过sendgrid发送电子邮件.我从sendgrid文档(smtapi类和swift)复制php代码.

我创建了一个模板,其中的地方应该用%variable%替换.现在我按照此处的定义为sendgrid创建标题:http://docs.sendgrid.com/documentation/api/smtp-api/developers-guide/

结果我看到这样的东西:

{
"to": ["mail1@domain.com", "mail2@domain.com", "mail3@domain.com", "mail4@domain.com", "sfwwnkff@sharklasers.com"], 
"sub": {"%firstname%": ["Benny", "Chaim", "Ephraim", "Yehuda", "will"]}, 
"section": {"%postername%": "John Doe", "%postermail%": "james@doe.com", "%categoryname%": "General", "%threadname%": "Completely new thread", "%post%": "This thread is to inform you about something very important", "%threadurl%": "http:\/\/hb.local\/forums\/general\/thread\/143", "%replyto%": "http:\/\/hb.local\/forums\/general\/thread\/143", "%unsubscribeurl%": "http:\/\/hb.local\/forums\/settings\/", "%subscribeurl%": "http:\/\/hb.local\/forums\/subscribe-thread\/id\/143\/token\/1b20eb7799829e22ba2d48ca0867d3ce"}
}
Run Code Online (Sandbox Code Playgroud)

现在,虽然"sub"中定义的所有数据都发生了变化,但我无法使该部分工作.在最后的电子邮件中,我仍然有%postername%.当我将这些数据移动到sub并为每封电子邮件重复它们时,一切正常.

有谁知道我做错了什么?

部分文档在这里:http://docs.sendgrid.com/documentation/api/smtp-api/developers-guide/section-tags/

ian*_*las 1

仅供参考,SendGrid 最近发布了一个新的 PHP 库。您可以在http://github.com/sendgrid/sendgrid-php找到它

(全面披露:我目前在 SendGrid 工作,我的团队开发了新库)