
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
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);
}
};```

Here are the errors I encounter:
type: 'general_argument_invalid',
response: {
message: "Invalid `bcc` param: Value must a valid array and UID must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, and underscore. Can't start with a leading underscore",
code: 400,
type: 'general_argument_invalid',
version: '1.6.0'
}```
```code: 400,
type: 'message_target_not_email',
response: {
message: 'Message with the target ID is not an email target.',
code: 400,
type: 'message_target_not_email',
version: '1.6.0'
}```

You are supposed to use the target ID

Oh, may I know where I can get the ID sir?

Is it these IDs?

hmm it's not working
Recommended threads
- How to reduce cold start times for cloud...
Is there anything I can do to prevent slow responses? How long does it take for a function to enter a "cold state"?
- Auth Error
`const user = await createSessionClient(session).account.get(); ` node-appwrite package can work but react-native-appwrite package cannot work. The only diffe...
- Is this 24h overview?
When checking cloud.appwrite.io/console/project/overview/platforms There is Database, Storage, Auth and Function overview (Image is pinned). Is this 24h usage ...
