Hi,
We are using python sdk on our backend to send email to our customer, now we want to add cc email on our emails where required, but I am not able to find any documentation how to acheive that, could you help me find that or share the body as an example with cc email in it.
Thanks
Add cc emails in an email
Hi Qasim,
I don’t think we have a traditional “CC” option for email. Rather, we support blind copies with `bcc` as shown in the example below.
from customerio import APIClient, Regions, SendEmailRequest
client = APIClient("your API key", region=Regions.US)
request = SendEmailRequest(
to="person@example.com",
bcc="bcc.address@example.com",
transactional_message_id="3",
message_data={
"name": "person",
"items": [
{
"name": "shoes",
"price": "59.99",
},
]
},
identifiers={
"id": "2",
}
)
with open("path to file", "rb") as f:
request.attach('receipt.pdf', f.read())
response = client.send_email(request)
print(response)
@chad
is it neccassary to add bcc. before entering the email address like you have done in the example, plus how the body will look like if I need to add 3 bcc emails,
FYI, currently I am doing this, and getting this error in return
This is my body
{
"transactional_message_id":"creator_invoice_sent_partner_brand_email",
"to":"Qasim@email1.live",
"identifiers":{
"id":"2da19e80-b5a6-4a12-ace0-50a6d8d3879e",
"email":"Qasim@email1.live"
},
"bcc":[
"Qasim+1@email1.live",
"Qasim+2@email1.live"
],
"message_data":{
"brand_manager_first_name":"Qaism",
"creator_full_name":"Testing Test",
"currency":"USD",
"amount":"153.75",
"total_vat_amount":"30.75",
"total_invoice_amount":"123.0"
}
}
and this is the error I am getting
"meta": {
"error": "Request entity must be JSON encoded and not exceed 3024 KB."
}
Could you please help me fix this, Thanks
Also I just checked, it is working with single bcc email, how can I add multiple bcc email in the body, the array of bcc seems to be not working
Hi Qasem,
Sorry for the confusion. It’s a bit odd, but the `bcc` field should just be a string with comma separated addresses. It’s a “stringified array.”
Also, the `identifiers` object only needs one value. You don’t need to provide both an email and an ID. I’m fairly sure that if you provide multiple values, we just use the first one.
I’ve updated the example below. I hope this helps!
{
"transactional_message_id":"creator_invoice_sent_partner_brand_email",
"to":"Qasim@email1.live",
"identifiers":{
"email":"Qasim@email1.live"
},
"bcc: "Qasim+1@email1.live, Qasim+2@email1.live",
"message_data":{
"brand_manager_first_name":"Qaism",
"creator_full_name":"Testing Test",
"currency":"USD",
"amount":"153.75",
"total_vat_amount":"30.75",
"total_invoice_amount":"123.0"
}
}
Thanks
Not receiving emails for bcc when using this bcc
bcc="qasim+2bcc@test.live, qasim+5@test.live",
works with single bcc email
bcc="qasim+2bcc@test.live",
would appreciate your help on this, thanks
I’m so sorry for the trouble Qasim. We’re not seeing the same problem when we test with our python library locally. I’d suggest submitting this question to our support team so that we can investigate further.
Reply
Login to the community
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.