Originally I found this which only vaguely pointed me in the right direction, so I thought I'd create a gist of what ended up working for me.
To add a CC address, you have to two two things
- Add the address to your recipeints array, and set the
header_to
value to an address in theto
field. So if you're sending the email to[email protected]
and CCing it to[email protected]
, theheader_to
for[email protected]
will need to be set to[email protected]
- Add the email to the
CC
headers
option incontent
object. If you have multiple emails, these should be comma separated.
BCC Seems to be simpler than CC since it's only one step, you just need to repeat step #1 from CC and you're good to go.
- Add the address to your recipeints array, and set the
header_to
value to an address in theto
field. So if you're sending the email to[email protected]
and BCCing it to[email protected]
, theheader_to
for[email protected]
will need to be set to[email protected]
Below is an example which worked for me:
{
"content": {
"subject": "Test Message",
"html": "This is a test message.",
"headers": {
"CC": "[email protected],[email protected]" // add all CC addresses here, comma separated
},
"from": {
"email": "[email protected]",
"name": "Test Sender"
}
},
"recipients": [{
"address": {
"email": "[email protected]",
"header_to": "[email protected]"
}
}, {
"address": {
"email": "[email protected]",
"header_to": "[email protected]" // note this address is the same as an address in the "to" field
}
}, {
"address": {
"email": "[email protected]",
"header_to": "[email protected]" // note this address is the same as an address in the "to" field
}
}, {
"address": {
"email": "[email protected]",
"header_to": "[email protected]" // note this address is the same as an address in the "to" field
}
}
],
}