1) How can I get unread emails using IMAP
2)how can I manually set the email status to read/unread.
3) How do I forward a email with all the content.
Please help me with this............I'm working on POC for Aspose Network. FYI I use C#
Thanks
Prashant
Please answer my question if this is possible with aspose or not. I have a presentation in 2 hours.
I need to provide proof of concept on aspose network.
Hi Prashant,
Sorry for not replying earlier.
You may also use the following code snippet:
ImapClient client =
null;
client =
new ImapClient(“host”, 143, “user”, “pwd”);
client.Connect(
true);
client.SelectFolder(“Inbox”);
ImapMessageInfoCollection msgInfoColl = client.ListMessages();
foreach (ImapMessageInfo msgInfo
in msgInfoColl)
{
Console.WriteLine(“Subject: " + msgInfo.Subject);
Console.WriteLine(“Read?: " + msgInfo.IsRead);
string fileName = msgInfo.Subject.Replace(”:”, " “).Replace(”?", " ");
// save as msg using MailMessage class MailMessage msg = client.FetchMessage(msgInfo.SequenceNumber);
msg.Save(fileName + “.msg”, MailMessageSaveType.OutlookMessageFormat);
}
3) For forwarding an email with all the content, you may first get the complete message using ImapClient.FetchMessage() method. Then call SmtpClient.Send() method. The code below may be added to the above example :
SmtpClient smtpClient = new SmtpClient("host", 25, "user", "pwd");
smtpClient.Send(msg);
Hey saqib ,
Thanks for ur reply but “msgInfo.IsRead” is always false. It doesn’t matter if its a new message or old message.
Regards
Prashant
Hi Prashant,
This is a bug and known issue in this version, which will be fixed soon.