算上使用Gmail的IMAP电子邮件数量 [英] Count number of emails in gmail using IMAP

查看:171
本文介绍了算上使用Gmail的IMAP电子邮件数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我怎样可以使用IMAP或别的东西得到来自Gmail我的收件箱未读邮件的数量和在C#中的WinForms标签显示呢?

Can anyone tell me how I can get the number of unread items in my inbox from gmail using imap or something else and display it in a label in C# WinForms?

我试着用原子饲料,但绝不能拿它

I tried using atom feeds, but never could get it

下面是我想要的样子,如果它可以帮助:

Here is what I want to look like, if it helps:

推荐答案

您可能希望找到与 UNSEEN 标记的所有邮件。

You probably want to find all messages with the UNSEEN flag set.

Imap imap = new Imap();
/* connect, login, etc. */
imap.Connect(...);
/* fill login and select folder code */

List<long> unseenList = imap.SearchFlag(Flag.Unseen);

// now you can get the count from unseeList
int unread = unseenList.Count;

这篇关于算上使用Gmail的IMAP电子邮件数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆