Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET IMAP

 AfterLogic Forum : MailBee.NET IMAP
Subject Topic: Is message read or unread!? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
hamipers
Newbie
Newbie


Joined: 06 March 2008
Location: United States
Online Status: Offline
Posts: 11
Posted: 07 May 2008 at 11:35am | IP Logged Quote hamipers

I retrieve email messages in a specific folder such as inbox by using Imap.DownloadEntireMessages method. I display them in a GridView in an ASP.NET web page and I would like to let the user distinguish between read and unread mail messages by changing the color of GridView rows according to read status of the messages. But when I looked into MailMessage class, I didn't find any property indicating that. How would I know that if a specific message has been read or not?
Back to Top View hamipers's Profile Search for other posts by hamipers
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 08 May 2008 at 6:15am | IP Logged Quote Andrew

To distinguish between read and unread messages, you should use Envelope.Flags property. SystemMessageFlags.Seen flag set means message is read, unset means unread.

To access message flags, you should download messages via Imap.DownloadEnvelopes method. Message data will be available in Envelope.MessagePreview property if you specify EnvelopeParts.MessagePreview in parts parameter of DownloadEnvelopes method.

However, you shouldn't download entire messages (EnvelopeParts.MessagePreview) to build message list, just envelopes with headers is enough, otherwise, it'll generate too much network traffic. Once a user clicks a message, your application should download the entire message to show its contents.

Also, once a message gets entirely downloaded from IMAP server (with EnvelopeParts.MessagePreview and bodyPreviewSize = -1), it's automatically marked as read. Downloading envelopes without EnvelopeParts.MessagePreview doesn't affect read/unread flag.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide