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
- Need help with createExecution function
Hi, Need some help understanding createExecution. When requesting function execution via createExecution, the function handler arguments are incorrect and rese...
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...