根据收到的日期需要有关IMAP INBOX搜索的帮助 [英] Need Help on IMAP INBOX Search based on received date

查看:77
本文介绍了根据收到的日期需要有关IMAP INBOX搜索的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用开源IMAP C#库IMapX(http://hellowebapps.com/products/imapx/). 当我尝试从INBOX接收电子邮件时,需要花费很多时间.有什么方法可以根据收到的日期过滤收件箱吗?

I am using a Open source IMAP C# library IMapX (http://hellowebapps.com/products/imapx/). When I trying to get the emails from INBOX it is taking lot of time. Is there any way to Filter inbox based on received date?

下面的代码是一个示例.搜索基于UNSEEN.我想根据收到的日期大于给定的日期进行过滤.

The below code is a sample. The search is based on UNSEEN. I want to filter based on received date is Greater than given date.

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;
    }

推荐答案

您可以使用IMAP搜索数据项SINCE.示例:"SINCE 18-Nov-2011". 或者,如果您也对UNSEEN感兴趣,则:"SINCE 18-Nov-2011 UNSEEN"

You can use IMAP search data item SINCE. Example: "SINCE 18-Nov-2011". Or if you interested in UNSEEN too then: "SINCE 18-Nov-2011 UNSEEN"

这篇关于根据收到的日期需要有关IMAP INBOX搜索的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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