This project is read-only.

BAD Missing or invalid argument to SEARCH

Jan 25, 2013 at 1:25 PM

I have tried to get messages from mailbox, I visited IMAPClient.Messages like this:

            DateTime date = DateTime.Now.AddDays(1);
            var result = client.Messages.Where(w => w.Date < date);
            foreach (var v in result)
            {
                string t = v.Subject;
            }

however, I noticed the debug output information:
21:14:19 =>> a04 SEARCH SENTBEFORE 26-Jan-2013
21:14:19 << a04 BAD Missing or invalid argument to SEARCH
What am I wrong? 
Jan 25, 2013 at 11:51 PM

You need to specify a select statement.

There is currently no auto select implemented.

Jan 26, 2013 at 3:32 AM
krasshirsch wrote:

You need to specify a select statement.

There is currently no auto select implemented.


I have finished the select statement yet. This is my full code:

            Crystalbyte.Equinox.Imap.ImapClient client = new Crystalbyte.Equinox.Imap.ImapClient();
            client.Connect("imap.qq.com", 143);
            client.Security = SecurityPolicies.None;
            client.Authenticate("example@qq.com", "password");
            client.Select("INBOX");

            DateTime date = DateTime.Now.AddDays(1);
            var result = client.Messages.Where(w => w.Date < date);
            foreach (var v in result)
            {
                string t = v.Subject;
            }
Jan 26, 2013 at 1:37 PM

I am sorry, I was unclear.

You need to specify a select statement for the LINQ query.

client.Messages.Where(...).Select(...);

Jan 27, 2013 at 5:01 AM
Edited Jan 27, 2013 at 5:01 AM

Thanks for your reply:)

I have tried to specify a select statement like this:

            Crystalbyte.Equinox.Imap.ImapClient client = new Crystalbyte.Equinox.Imap.ImapClient();
            client.Connect("imap.qq.com", 143);
            client.Security = SecurityPolicies.None;
            client.Authenticate("example@qq.com", "password");
            client.Select("INBOX");

            DateTime date = DateTime.Now.AddDays(1);
            var result = client.Messages.Where(w => w.Date < date).Select(w=>w.Subject);
            foreach (var v in result)
            {
                string t = v;
            }
            Console.ReadKey();

But I still get the "BAD Missing or invalid argument to SEARCH"