开发者

Can we Synchronize the Gmail mails using Mail.dll

开发者 https://www.devze.com 2023-02-11 07:45 出处:网络
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 wind

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


  1. You can get all emails, not only those with unseen flag: just use Imap.GetAll() method.

  2. You can mark message as unseeen using Gmail online interface: just mark the mail, click "more actions", and click "mark as unread"

  3. 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();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消