2011-02-16 43 views
0

我正在使用Mail.dll商业组件。我可以在我的Windows应用程序中读取看不见或未读的消息。如果我使用gmail.com打开邮件,那么我无法在Windows应用程序中获得邮件。有什么办法来同步Gmail的邮件我们是否可以使用Mail.dll同步Gmail邮件

+0

你要走了克必须给我们更多的信息。具体是什么“Mail.dll”(制造商,版本等)?组件如何访问Gmail(HTTP/IMAP/POP)?你有可以发布的代码示例吗? – 2011-02-16 14:31:39

+0

Mail.dll是[http://www.lesnikowski.com/mail/](http://www.lesnikowski.com/mail/) – 2011-02-17 13:19:25

回答

1
  1. 你可以得到所有的电子邮件,不仅 那些看不见的标志:只使用 Imap.GetAll()方法。

  2. 您可以将邮件标记为使用Gmail网络接口unseeen :刚刚 标记邮件,点击“更多操作”, 并点击“标记为未读”

  3. 可以最后处理的uid保存在您的Windows应用程序:

下面的代码:

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(); 
} 
相关问题