[英]How to send an email in Sendgrid to a single recipient using dynamic template and obtain the sent HTML for retention purposes
[英]Recipient detail in SendGrid Dynamic Template
我需要向 SendGrid 中的多个收件人发送有效负载。 我使用动态模板构建 email 主体,一切正常。
我想在 email 中添加一行“Hi {{recipientName}}
”,但我找不到任何关于它的文档,可以吗?
我不能在有效负载中包含收件人详细信息,因为单个有效负载会发送给许多收件人
使用个性化。
个性化允许您为 API 请求中的每个 email 覆盖这些不同的元数据。
您的请求将如下所示:
{
"from": "gilbert@techmail.com",
"template_id": "YOUR TEMPLATE ID",
"personalizations": [
{
"to": [
{
"email": "john@example.com"
}
],
"substitutions": {
"%fname%": "John",
"%CustomerID%": "C001"
},
},
{
"to": [
{
"email": "peter@example.com"
}
],
"substitutions": {
"%fname%": "Peter",
"%CustomerID%": "C005"
},
"send_at": 1629723541
}
]
}
它将 go 作为一个请求。
另请查看此github 评论。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.