我正在尝试在 cURL 中构建一个 API,以分别向超过 100,000 多个收件人发送电子邮件
(即看起来应该是我亲自将邮件发送给他的)。我还将使用一个动态模板,它有 3 个参数可以传递 - first_name
, date
, & city
。我应该如何在 cURL 中为上述想法构建 API?我是 API 和 cURL 的初学者 - 这就是为什么我有点困惑
另外,我尝试使用下面的代码(参考),但我不确定我应该把我的 // 参数放在哪里first_name
-city
你date
也能指导我吗?
curl --request POST \
--url https://api.sendgrid.com/v3/mail/send \
--header 'authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{"personalizations": [{"to": [{"email": "recipient@example.com"}]}],"from": {"email": "sendeexampexample@example.com"},"subject":"Hello, World!","content": [{"type": "text/plain","value": "Heya!"}], "template_id" : "YOUR_TEMPLATE_ID"}'
我发现单个 API 调用只能支持 1000 个收件人 - 所以为了覆盖 100,000 人,我会进行 100 次这样的 API 调用(每个调用 1000 个收件人)。