[英]Recipient detail in SendGrid Dynamic Template
I need to send a payload to multiple recipients in SendGrid.我需要向 SendGrid 中的多个收件人发送有效负载。 I use the Dynamic Templates to construct the email body, and all is working fine.
我使用动态模板构建 email 主体,一切正常。
I would like to add a 'Hi {{recipientName}}
' line to the email but I cannot find any documentation on it, is it possible?我想在 email 中添加一行“Hi
{{recipientName}}
”,但我找不到任何关于它的文档,可以吗?
I cannot include the recipient detail in the payload as a single payload goes out to many recipients我不能在有效负载中包含收件人详细信息,因为单个有效负载会发送给许多收件人
Use personalizations .使用个性化。
Personalizations allow you to override these various metadata for each email in an API request.
个性化允许您为 API 请求中的每个 email 覆盖这些不同的元数据。
Your request will look like this:您的请求将如下所示:
{
"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
}
]
}
and it will go as a single request.它将 go 作为一个请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.