Remove permanently mails from trash
The secrecyClient.mail.deleteTrash method makes a hard delete of mails. That means that the mails are permanently deleted.
Delete mails by ID
The secrecyClient.mail.deleteTrash is a method which attempts to delete permanently specified mails by their IDs, returning a boolean status indicating whether the operation was successful. As argument it takes the mailsIds array as the parameter ids.
In other words, selected mails will be removed permanently from the trash
mail.ts
const deleteMailsById = async (mailsIds: string[]): Promise<boolean> => {
// First we need to check if the secrecyClient is available
if (!secrecyClient) {
return false;
}
try {
// return true if the mails have been deleted
const isDeleted = await secrecyClient.mail.deleteTrash({ ids: mailsIds });
return isDeleted;
} catch (error) {
console.error(error);
return false;
}
};To clear the whole trash in a single call rather than listing ids, use delete all mails from trash.