Need Help on IMAP INBOX Search based on received d

2019-05-11 16:59发布

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?

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
1条回答
▲ chillily
2楼-- · 2019-05-11 17:51

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"

查看更多
登录 后发表回答