I want to send email to multiple users in a single request by putting them all in Bcc and in to I put myself that is my second email so that all the users get mail but I got error that Bcc is not with correct format
const broadCastEmail = async (emails) => {
// Create a Postmark client with your server token
const client = new postmark.ServerClient(
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
);
const path = "./public/logo.png";
const logoAttachment = await createAttachment(path, "Logo_solo.png");
console.log(emails);
const emailParams = {
From: "[email protected]",
To: "[email protected]", // You can set the primary recipient here
Bcc: ["[email protected]", "[email protected]"],
Subject: "Your email subject",
HtmlBody: "<p>Hello, this is a test email.</p>",
Attachments: logoAttachment,
};
// Send the email
client
.sendEmail(emailParams)
.then((response) => {
console.log("Email sent successfully");
console.log(response);
})
.catch((error) => {
console.error("Error sending email:", error);
});
};