I am using Aspose.Email v21.4.0.
With the following code I am trying to get an email message from an Imap server.
Currently, if the email message is marked as read, right after FetchMessage is executed it marks it as read . Is there a way to go around it? as I don’t want to make changes on message flags, just fetching its info.
ImapClient imapClient = new ImapClient(“imap-mail.outlook.com”, “user-name”, “password”);
imapWrapper.SecurityOptions = Aspose.Email.Clients.SecurityOptions.SSLImplicit;
imapWrapper.Port = 993;
imapClient.FetchMessage(uniqueId); //let’s assume I have the right uniqueId
@Orenk9,
Thank you for posting the query. FETCH command sets the SEEN flag for messages on the IMAP server automatically. But you can reset the flag as shown below:
I would like to set unread only for emails that were unread before fetching them.
Is there a way to determine whether an email message is set to be read/unread before fetching it?
@Orenk9,
Unfortunately, I found no way to check this flag. I added a ticket with ID EMAILNET-40324 in our tracking system. Our development team will investigate this possibility. I will inform you of any news.
@Orenk9,
Our development team investigated your requirements. You can use ImapClient.ListMessages method to check whether an email message with defined UniqueId is set to be read/unread. This method does not change read/unread flag of messages. Also, the ImapMessageInfo object contains other useful information.
Code example: