Mark mail as read
The secrecyClient.mail.mail
method marks mail as read, passing the mailId
as part of an options object.
It provides a boolean result indicating the success or failure of the email marking.
mail-trash.ts
const readMail = async (mailId: string): Promise<boolean> => {
// First we need to check if the secrecyClient is available
if (!secrecyClient) {
return false;
}
try {
const isRead = await secrecyClient.mail.read({ mailId: mailId });
return isRead;
} catch (error) {
console.error(error);
return false;
}
};
Mark mail as unread
The secrecyClient.mail.unread
method marks mail as unread, passing the mailId
as part of an options object.
It provides a boolean result indicating the success or failure of the email marking.
mail-trash.ts
const unreadMail = async (mailId: string): Promise<boolean> => {
// First we need to check if the secrecyClient is available
if (!secrecyClient) {
return false;
}
try {
const isUnRead = await secrecyClient.mail.unread({ mailId: mailId });
return isUnRead;
} catch (error) {
console.error(error);
return false;
}
};