mailersend / mailersend-nodejs

The official MailerSend Node.js SDK
https://developers.mailersend.com
MIT License
136 stars 17 forks source link

bcc doesnt work. #32

Closed mharithzahid closed 2 years ago

mharithzahid commented 2 years ago

I've follow the code sample below from your docs

const Recipient = require("mailersend").Recipient;
const EmailParams = require("mailersend").EmailParams;
const MailerSend = require("mailersend");

const mailersend = new MailerSend({
    api_key: "key",
});

const recipients = [
  new Recipient("your@client.com", "Your Client")
];
const cc = [
  new Recipient("your_cc@client.com", "Your CC Client")
];
const bcc = [
  new Recipient("your_bcc@client.com", "Your BCC Client")
];

const emailParams = new EmailParams()
      .setFrom("your@domain.com")
      .setFromName("Your Name")
      .setRecipients(recipients)
      .setCc(cc)
      .setBcc(bcc)
      .setSubject("Subject")
      .setHtml("This is the HTML content")
      .setText("This is the text content");

mailersend.send(emailParams);

The error

[0]   [Symbol(Response internals)]: {
[0]     url: 'https://api.mailersend.com/v1/email',

[0]     status: 422,
[0]     statusText: 'Unprocessable Content',
[0]     headers: Headers { [Symbol(map)]: [Object: null prototype] },
[0]     counter: 0
[0]   }
opheus2 commented 2 years ago

This issue isn't reproducible. Please ensure to check that you are not passing an existing recipient's email in either your CC or BCC