I am using Mail.dll Commercial component. I can read the unseen or unread messages in my windows application. IF i open the mail using the gmail.com then I cannot ge开发者_Python百科t the mail in windows application. Is there any way to synchronize the gmail mails
You can get all emails, not only those with unseen flag: just use Imap.GetAll() method.
You can mark message as unseeen using Gmail online interface: just mark the mail, click "more actions", and click "mark as unread"
You can save last processed uid in your windows application:
Here's the code:
long lastProcessedUID = GetLastProcessedUID(); // returns -1 on first run
using (Imap client = new Imap())
{
List<long> allUids = client.GetAll();
List<long> toBeProcessed = allUids.FindAll(x => x > lastProcessedUID);
foreach (long uid in toBeProcessed)
{
// process message here
SaveLastProcessed(uid);
}
client.Close();
}
精彩评论