sendinblue / APIv3-ruby-library

MIT License
43 stars 31 forks source link

Send bcc email to multiple recipients #45

Closed kouroubel closed 3 years ago

kouroubel commented 4 years ago

I cannot send a transactional bcc email to multiple recipients without having the email.to. Specifically the following code works.

`
api_instance = SibApiV3Sdk::TransactionalEmailsApi.new

email = SibApiV3Sdk::SendSmtpEmail.new
email.sender = {
  "name": "Sender_name",
  "email": "noreply@example.com"
}

email.to = [{ "email": "email1@example.com" } ] #bad request when this line is not present
email.bcc = [{ "email": "email2@example.com"}, { "email": "email3@example.com"} ]

email.text_content = body_text
email.subject = subject_text

api_instance.send_transac_email(email)

`

However, without the email.to line I get a SibApiV3Sdk::ApiError (Bad Request) with response_code=400.

How can I resolve this?

aakanksha-sib commented 3 years ago

Hi @kouroubel , It is mandatory to pass the to email address(es) while sending transactional emails. This parameter can't be skipped.

Thanks! Aakanksha