Free Support Forum - aspose.com

Aspose Imap client issues

Hello,


I am evaluating the latest Aspose .NET Imap libraries (Apose.Net 4.8.1) and I am having some trouble with reading the message flags.
I have tried to connect to two separate Imap server to pull message info and this issue happens both times.
I would like to retrieve data only for messages without the “Seen” flag or ImapMessageFlags.Readed.
I have telneted into my Imap servers and I have verified that the “Seen” flag is not on the messages.
Furthermore I have also removed the “Seen” flag using:
ImapMessageInfoCollection messageColl = imapClient.ListMessages();
foreach (ImapMessageInfo messageInfo in messageColl)
{
imapClient.RemoveMessageFlags(messageInfo.UniqueId, ImapMessageFlags.Readed);
}
and I have verified this works.
However when I later try to retrieve the messageInfo flags there seem to be no flags.
The following:
(messageInfo.Flags & ImapMessageFlags.Readed).IsEmpty()
is ALWAYS true meaning the “Seen” flag is not well Seen.
Am I missing something ?

Thank you in advance.

Hi,

Thanks for considering Aspose.

For a new message (un-seen), ImapMessageInfo.Flags is shown an empty.
For a message that is read (seen), ImapMessageInfo.Flags will show “Readed”.

If you want to retrieve un-seen messages, please check ImapMessageInfo.Readed property for false value.
if (msgInfo.Readed == false)
{
// do something with un-seen messages
}

If a message is un-seen, it means its flags are empty. And if you want to mark it as seen, then you need to add “Readed” flag to it by calling ImapClient.AddMessageFlags(msgInfo.SequenceNumber, ImapMessageFlags.Readed);