我正在使用开源IMAP C#库IMapX(http://hellowebapps.com/products/imapx/).当我试图从INBOX收到电子邮件时,需要花费很多时间.有没有办法根据收到的日期过滤收件箱?
以下代码是一个示例.搜索基于UNSEEN.我想根据收到的日期过滤大于给定日期.
ImapX.ImapClient client = new ImapX.ImapClient("imap.gmail.com", 993, true);
bool result = false;
result = client.Connection();
if (result)
MessageBox.Show("Connection Established");
result = client.LogIn(textBox1.Text, textBox2.Text);
if (result)
{
MessageBox.Show("Logged in");
ImapX.FolderCollection folders = client.Folders;
ImapX.MessageCollection messages = client.Folders["INBOX"].Search("UNSEEN", true); //true - means all message parts will be received from server
int unread = messages.Count;
string unseen = unread.ToString();
button1.Text = unseen;
}
Run Code Online (Sandbox Code Playgroud)
小智 8
您可以使用IMAP搜索数据项SINCE.示例:"SINCE 18-Nov-2011".或者,如果您对UNSEEN感兴趣,那么:"自2011年11月18日至今UNSEEN"
| 归档时间: |
|
| 查看次数: |
7806 次 |
| 最近记录: |