We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How get headers of unread messages

I have ~600 messages in mail. I want get only headers of unread messages? How i make it ?

Hi Mesteruh,

Thank you for contacting Aspose Support team.

Could you be a little more specific about what email client you are using at your end and the headers information you require? The following code sample shows how to retrieve unread messages from Exchange Server and then lists basic headers information such as subject.

Sample Code:

IEWSClient client = GetAsposeEWSClient();

//Create a filter to list only unread messages
ExchangeQueryBuilder builder = new ExchangeQueryBuilder();

//list the messages
ExchangeMessageInfoCollection msgsColl = client.ListMessages(client.MailboxInfo.InboxUri, builder.GetQuery());

//get the headers information
foreach (ExchangeMessageInfo msgInfo in msgsColl)

POP Have command

**[http://www.nthelp.com/pop_commands.htm ](http://www.nthelp.com/pop_commands.htm)**


Aspose.Email’s Pop3Client supports getting headers, but it doesn’t support reading unread messages only. You will have to use your own logic to mark retrieved messages as read so that next time you don’t fetch headers for these again. Please use the Pop3Client.GetMessageHeaders method to retrieve message headers using the message’s sequence number.