tags:

views:

195

answers:

3

SEARCH TEXT "Joe says: "i want to search" and exits."

how can i search this text with IMAP SEARCH

this doesn't work : "Joe says: \"i want to search\" and exits."

A: 

Since you don't say how you're searching IMAP, I can't give you a definitive answer, but could it be that you have to double-escape the quotation marks? Once for C# and once for the IMAP search?

string searchString = "Joe says: \\\"i want to search\\\" and exits.";
lc
A: 

IMAP search does not support arbitrary string -- so no, there is no way to do this.

J-16 SDiZ
OK maybe. IMAP SEARCH with REGEX? and how to? any source?
jack london
A: 

Hi,

searching in IMAP using C# is shown in our Rebex IMAP tutorial.

// create client, connect and log in  
Imap client = new Imap();
client.Connect("server");
client.Login("username", "password");

// select the folder for search operation  
client.SelectFolder("Inbox");

ImapMessageCollection fromJoe = client.Search
(
  ImapSearchParameter.Body("Joe says: \"i want to search\" and exists.");
); 

The component takes care of correct escaping automatically.

If you are curious how it is escaped try producing a log as shown at rebex.net/kb/logging.aspx and check the IMAP commands and responses.

Martin Vobr