Restore mail from trash
The secrecyClient.mail.recover
method restores mail from the trash back, passing the mailId
as part of an options object.
It provides a boolean result indicating the success or failure of the email recovery.
mail-trash.ts
const removeMailFromTrash = async (mailId: string): Promise<boolean> => {
// First we need to check if the secrecyClient is available
if (!secrecyClient) {
return false;
}
try {
const isRestored = await secrecyClient.mail.recover({ mailId: mailId });
return isRestored;
} catch (error) {
console.error(error);
return false;
}
};