IMAP4 Search: Can't t search mail

0 votes
asked Jun 15, 2012 by pliao (160 points)
edited Jun 18, 2012

Imap Links to the server :imap.sohu.com 143 login and select inbox complexFilterResult = imapClient.Search( _ ImapSearchParameter.Arrived(DateTime.Date.AddDays(-1), DateTime.Now.AddDays(1)), _ ImapSearchParameter.Subject("test")) Inbox have the mail, but the method can't find some mail

Applies to: Rebex Secure Mail

2 Answers

0 votes
answered Jun 15, 2012 by Tomas Knopp (58,890 points)
edited Jun 15, 2012

Please try the Search method without specifying the subject. Is the email with the subject "test" present in the ImapMessageCollection then?

        string subject = "test";
        Imap imapClient = new Imap();

        // connect and login here

        imapClient.SelectFolder("INBOX");

        ImapMessageCollection list = imapClient.Search(ImapSearchParameter.Arrived(new DateTime(2011, 6, 14).Date, DateTime.Now.AddDays(1)));

        // check if there is mail with the specified subject
        foreach (ImapMessageInfo info in list)
        {
            Console.WriteLine(info.Subject);

            if (info.Subject == subject)
            {
                Console.WriteLine("Got email with '{0}' subject", subject );
            }
        }
0 votes
answered Jun 18, 2012 by pliao (160 points)
edited Jun 18, 2012

ImapMessageCollection list = imapClient.Search(ImapSearchParameter.Arrived(new DateTime(2011, 6, 14).Date, DateTime.Now.AddDays(1)));

but list.count=0 is abnormal

commented Jun 18, 2012 by Tomas Knopp (58,890 points)
edited Jun 18, 2012

It looks like the IMAP server does not support searching for mails according to arrived time. Could you please create the log using the LogWriter property as described at http://www.rebex.net/kb/logging/default.aspx and paste it here or mail to support@rebex.net?

...