This project is read-only.

Search queries

Dec 17, 2012 at 1:37 PM


can I know all possibile search queries?

Thank you.

Dec 17, 2012 at 3:19 PM

Hello y_chen!

The search queries can be quite complex, because you can combine multiple filters to look for messages. I think the best source for the complete list of possible search parameters is the official IMAP specification. You can find the details about the search command here.

With the next release of the library coming in january you won't need to build these queries yourself anymore and can simply use built-in methods to filter your search requests.

Best regards,

Pavel Azanov

Dec 17, 2012 at 3:35 PM
Edited Dec 17, 2012 at 3:35 PM

Thank you for the answer.

Yes, I see, there are a lot of queries. I will make some test but I think that "ALL" and "SINCE" are enough for me.

Anyway can I ask you some other question?

The "SINCE" query accepts only a date in 17-Dec-2012 format? I receive a Bad or not correct search query exception if I try to use something else.

Why get a FormatException with the code ImapX.MessageCollection messages = client.Folders["INBOX"].Search("SINCE 17-Dec-2012", true)?

I skipped this problem using ImapX.MessageCollection messages = client.Folders["INBOX"].Search("SINCE 17-Dec-2012", false) but when I read some messages I have the same exeption on the method Message.Process() exactly when I'm reading the email with the attachment that I need to download.

Dec 19, 2012 at 12:42 PM
Edited Dec 19, 2012 at 12:43 PM

You're welcome.

The dates passed to the BEFORE, ON, SENTBEFORE, SENTON, SENTSINCE and of course the SINCE query are always in the format date-day "-" date-month "-" date-year as described in the formal syntax part of the specification.

It's really not a pleasent thing about IMAP, a pity you can only filter letters by date and not by time. Can be critical if you deal with big amounts of data.

Coming to the FormatException you mentioned - I need more details about it. You can post a stacktrace, or try sending me an exported *.eml file to The parsing alghorithms are still not ideal and we work on improving that, so all kind of feedback and bug reports are welcome.





Dec 20, 2012 at 8:56 AM


I sent you an email with the informations that you asked.

Hope it helps.

Thank you again.

Dec 20, 2012 at 6:35 PM
Edited Dec 20, 2012 at 6:36 PM

Hello y_chen,

thank you, the problem was as I thought, - some messages contained attachments that were encoded with quoted-printable, and not with base64 as it is mostly the case.

I updated the code in the repository. You can download and compile it. The files in the download section do not yet contain the fix, but will be updated this weekend. Want to fix few more bugs before making a stable release.