我正在尝试在Zend应用程序中通过sendgrid发送电子邮件。我从sendgrid文档(smtpapi类和swift)中复制了PHP代码。
我创建了一个模板,并用%variable%替换了应该被替换的位置。现在,我按照此处定义的方式为sendgrid创建标题:http://docs.sendgrid.com/documentation/api/smtp-api/developers-guide/
结果看起来像这样:
现在当所有在“sub”中定义的数据发生变化时,我不能使部分起作用。在最终的电子邮件中,我仍然得到%postername%。当我将这些数据移动到“sub”并为每个电子邮件重复它们时,一切都正常工作。
有人知道我做错了什么吗?
部分的文档在这里:http://docs.sendgrid.com/documentation/api/smtp-api/developers-guide/section-tags/
我创建了一个模板,并用%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"}
}
现在当所有在“sub”中定义的数据发生变化时,我不能使部分起作用。在最终的电子邮件中,我仍然得到%postername%。当我将这些数据移动到“sub”并为每个电子邮件重复它们时,一切都正常工作。
有人知道我做错了什么吗?
部分的文档在这里:http://docs.sendgrid.com/documentation/api/smtp-api/developers-guide/section-tags/