如何在Sendgrid v3中添加CC收件人?

时间:2016-12-06 17:54:33

标签: php sendgrid cc

您好我需要在PHP中使用sendgrid v3 API添加其他“cc”收件人。我该怎么做?

在文档中,他们提供了以下代码,但我发现它不够,因为我需要了解如何添加“CC”收件人。

$request_body = json_decode('{
  "personalizations": [
{
  "to": [
    {
      "email": "test@example.com"
    }
  ],
  "subject": "Hello World from the SendGrid PHP Library!"
}
],
"from": {
"email": "test@example.com"
},
"content": [
{
  "type": "text/plain",
  "value": "Hello, Email!"
}
]
}'
);

1 个答案:

答案 0 :(得分:0)

在尝试和疯狂搜索之后,我找到了答案:

$request_body = json_decode('{  "personalizations": [
{
  "to": [
    {
      "email": "mailto@domiain.com"
    }
  ],
  "cc":[
    {
        "email": "mailcc@domiain.com"
  }],
  "subject": "Hello world"
}  
],  
"from": {
"email": "robot@server.com"
},"content": [
{
  "type": "text/html",
  "value": "<strong>Hello</strong>, Email!"
}]}');