Get the number of unread mails
The secrecyClient.mail.unreadReceivedMailsCount
is a method that returns the count of unread received mails. This method is ideal for allowing you to add a counter. For example, you can display the number of unread mails in the header of your application.
mail.ts
const getUnreadReceivedMailsCount = async (): Promise<number | null> => {
// First we need to check if the secrecyClient is available
if (!secrecyClient) {
return null;
}
try {
const count = await secrecyClient.mail.unreadReceivedMailsCount();
return count;
} catch (error) {
console.error(error);
return null;
}
};