我正在尝试通过 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"}
}
现在,虽然“子”中定义的所有数据都发生了变化,但我无法使部分工作。在最后一封电子邮件中,我仍然收到 %postername%。当我将这些数据移动到 sub 并为每封电子邮件重复它们时,一切正常。
有谁知道我做错了什么?
部分的文档在这里:http ://docs.sendgrid.com/documentation/api/smtp-api/developers-guide/section-tags/