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
- Unable to create Sites or Functions with...
Heya, I was looking at the appwrite documentation for Sites API with the server api: https://appwrite.io/docs/references/cloud/server-nodejs/sites I can’t fin...
- Triggers and call function in function p...
Hello, Today we are experiencing several issues with Appwrite Cloud. Functions triggered by events, or functions called from another function, are taking an e...
- TablesDB `updateRows` returns `database_...
Hi Appwrite team! I’m seeing a strange issue with TablesDB bulk row updates on a self-hosted Appwrite instance. **Environment** - Appwrite self-hosted `1.9.0` ...