【问题标题】:cc and bcc not working for try to send mail using Web_API_v3cc 和 bcc 无法尝试使用 Web_API_v3 发送邮件
【发布时间】:2016-07-27 13:15:22
【问题描述】:

我正在尝试使用 API 请求发送带有“cc”和“bcc”的电子邮件 POST https://api.sendgrid.com/v3/mail/send HTTP/1.1.

我遇到了这样的错误

{"errors":[{"message":"The to array is required for all personalization objects, and must have at least one email object with a valid email address.","field":"personalizations.1.to","help":"http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.personalizations.to"},{"message":"The to array is required for all personalization objects, and must have at least one email object with a valid email address.","field":"personalizations.2.to"}]}

像这样使用数据部分

--data '{"personalizations": [{"to": [{"email": "example@email.com"}]},{"cc": [{"email": "example@email.com"}]},{"bcc": [{"email": "example@email.com"}]}],"from": {"email": "example@email.com"},"subject": "Hello, World!","content": [{"type": "text/plain", "value": "Heya!"}]}'

【问题讨论】:

  • 这个属于sendgrid支持而不是stackoverflow

标签: node.js api sendgrid


【解决方案1】:

您的 JSON 不适合此用例。您将在“to”对象之后关闭个性化对象,此时它还应包含 ccbcc 对象。

Here's an example.

{
  "personalizations": [{
      "to": [{
          "email": "recipient1@example.com"
      }],
      "cc": [{
          "email": "recipient2@example.com"
      }],
      "bcc": [{
          "email": "recipient3@example.com"
      }]
  }]
}

您也可以将subject 放入个性化设置,但不能将fromcontent-type

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-11
    • 1970-01-01
    • 2010-12-05
    • 1970-01-01
    • 2021-06-23
    • 2017-01-25
    相关资源
    最近更新 更多