Get mails from trash
The secrecyClient.mail.deletedMails
method is used to get all the mails that have been soft deleted. It accepts an argument of type mailType
that can only have one of two string values: sent
or received
.
The mailType
property is equal to : sent
|
received
Get sent deleted mails
The secrecyClient.mail.deletedMails
is a method that retrieves deleted sent mails using the secrecyClient. It accepts a parameter mailType of type MailType
, which is a union type that can either be sent
or received
.
mail-trash.ts
type MailType = 'sent' | 'received';
const getSentMailsFromTrash = async (
mailType: MailType
): Promise<Mail[] | null> => {
// First we need to check if the secrecyClient is available
if (!secrecyClient) {
return null;
}
try {
// retrieve the deleted sent mails
const deletedSentMails = await secrecyClient.mail.deletedMails({
mailType: 'sent',
});
return deletedSentMails;
} catch (error) {
console.error(error);
return null;
}
};
Get received deleted mails
The secrecyClient.mail.deletedMails
is a method that retrieves deleted received mails using the secrecyClient. It accepts a parameter mailType of type MailType
, which is a union type that can either be sent
or received
.
mail-trash.ts
type MailType = 'sent' | 'received';
const getSentMailsFromTrash = async (
mailType: MailType
): Promise<Mail[] | null> => {
// First we need to check if the secrecyClient is available
if (!secrecyClient) {
return null;
}
try {
// retrieve the deleted received mails
const deletedReceivedMails = await secrecyClient.mail.deletedMails({
mailType: 'received',
});
return deletedReceivedMails;
} catch (error) {
console.error(error);
return null;
}
};