1

Hello I need to add other "cc" recipients using the sendgrid v3 API in PHP. How do I do it?

In the documentation they put the following code, but I find it insufficient, because I need to see how to add "CC" recipients.

$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!"
}
]
}'
);
Luis
  • 2,006
  • 5
  • 31
  • 47
  • 2
    Scroll down to request body parameters and read the documentation: https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html – silentsod Dec 06 '16 at 18:26

1 Answers1

0

After trying and searching like crazy I found the answer:

$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!"
}]}');
Luis
  • 2,006
  • 5
  • 31
  • 47