Imap search parameter including quotes doesn't work

0 votes
asked Nov 25, 2016 by pilouk (520 points)

I'm trying to filter some messages by searching for example with this value : id="1122" Note quotes must be included

Here my email :

    <?xml version="1.0" encoding="UTF-8" ?>
<adf>
  <prospect status="new">
    <requestdate>2016-10-17T12:22:51.8840989-04:00</requestdate>
    <vendor id="1122">
      <vendorname>TEST VENDOR</vendorname>
    </vendor>

The search return 0 email, however if only limit the search to 1122
the email is found.

What must i do to include the quotes in search ??

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Nov 28, 2016 by Lukas Matyska (33,580 points)

To include quotes, just include them in the input string. Like this:

C#:

imap.Search(ImapSearchParameter.Subject("ID=\"1122\""))

VB.NET:

imap.Search(ImapSearchParameter.Subject("ID=""1122"""))

However, please note that it depends on the IMAP server how it will interpret the parameter.

For example Gmail searches only for whole words in subject. E.g. Gmail matches "VENDOR" but not "VEND".

commented Nov 29, 2016 by pilouk (520 points)
edited Nov 29, 2016 by pilouk
I search the body with this New ImapSearchParameter() {ImapSearchParameter.Body("id=""1122""")}  but none is found is there a way to see what actually is searching ??
commented Nov 29, 2016 by Lukas Matyska (33,580 points)
You can create VERBOSE log of the communication to see, what requests are sent to server and what responses are received.
Follow http://www.rebex.net/kb/logging/default.aspx and specify LogLevel.Verbose
...