yehiorOriginal post
Web Developer
Hi, I was trying to create an email notification function, the code below works perfectly for single recipient, but I can't added more recipients using cc/bcc.
I have tried so many syntax but can't find the correct one, anyone know how to solve this so I can add more emails using CC? I have tried both email and UID btw
Plain text
recipientEmail: string, subject: string, content: string, appointmentSchedule: Date) => { try { const scheduledTime = new Date(appointmentSchedule).toISOString();
console.log(ID.unique()); // console.log(ccEmails); console.log(recipientEmail);
const message = await messaging.createEmail( ID.unique(), // Unique message ID subject, // Subject of the email content, // Content of the email [], // Topics (optional) [recipientEmail], // List of user emails (you can include more) [], // Targets (optional) ["example@mail.com"], // CC (optional) [], // BCC (optional) [], // Attachments (optional) false, // Draft (optional) true, // HTML content scheduledTime );
return parseStringify(message); } catch (error) { console.error("An error occurred while sending email:", error); }};```Summary
Developers are trying to add CC to their email function but encountering issues with incorrect syntax. Errors received indicate invalid parameters for CC and BCC. The function works for single recipients but not multiple. To fix this, ensure the array for CC/BCC contains valid emails or UIDs.