【发布时间】:2017-01-08 18:50:43
【问题描述】:
我正在使用 SendGrids Web API v3 成功发送电子邮件,但在使用模板发送电子邮件时无法使替代功能正常工作。电子邮件成功通过,但没有发生替换。这是我的(简化的)SendGrid 模板:
<html>
<head>
<title></title>
</head>
<body>
<div>You can reset your password by clicking on this link: {callbackUrl}</div>
<%body%>
</body>
</html>
这是我发送的 JSON 格式的正文:
{
"personalizations":[
{
"to":[
{
"email":"destinationemail@gmail.com"
}
]
}
],
"sub" : {
"{callbackUrl}" : "www.mysite.com/changepassword"
},
"from":{
"email":"example@example.com"
},
"template_id" :"5f852a2e-996b-4f04-be05-31766d1092d8",
"subject":"Reset your password",
"content":
[
{"type": "text/plain", "value": "Thank you"}]
}
使用正确的模板、主题生成电子邮件,并发送到正确的电子邮件地址,但电子邮件正文包含没有替换的模板:
You can reset your password by clicking on this link: {callbackUrl}
Thank you
我不知道自己做错了什么。我目前正在使用 Postman 发送请求,同时尝试追踪问题。
【问题讨论】:
标签: sendgrid-api-v3