【发布时间】:2020-07-31 17:14:26
【问题描述】:
我将文本作为 html 存储在数据库中。我想将该文本转换为可以使用 sendgrid 作为附件发送的文件。有谁知道怎么做?这是我目前所拥有的
var body = {
subject: book.title + " test Original",
personalizations:
[{
to: [{email: to,}]
}],
content: [{type: "text/plain", value: book.title + " book summary"}],
from: {email: 'info@test.com', name: 'test Team'},
attachments: [
{
filename: book.id + ".html",
content: btoa(book.body),
type: 'text/html',
disposition: 'attachment'
}
]
};
this.sendMail(body)
我想使用 node 和 javascript 来做到这一点。我更新了上面的代码。
【问题讨论】:
标签: javascript node.js sendgrid sendgrid-api-v3