Documentation
Client SDK
Empty the trash

Delete all mails from the trash

The secrecyClient.mail.emptyTrash permanently removes all mails from the trash. It does not take any parameters.

mail-trash.ts
const deleteAllMailsFromTrash = async (): Promise<boolean> => {
  // First we need to check if the secrecyClient is available
  if (!secrecyClient) {
    return false;
  }
 
  try {
    const isDeleted = await secrecyClient.mail.emptyTrash();
    return isDeleted;
  } catch (error) {
    console.error(error);
    return false;
  }
};