login about faq

Hi Guys,

I'm trying to put together some code that scans users Sent Mail folders looking for emails with a set of tag text (e.g. [TAG: ) that have been filed after 1st January 2015, but the Chilkat component seems to be having problems.

The search query that I'm passing to Chilkat's Search method is: AND (SINCE 01-Jan-2015) (BODY "[TAG:")

The results seem to be very unreliable with Office365 refusing to return anything (even though I know that there are matching emails) but GMail working fine. I'm assuming that this will be down to something like Microsoft's implementation of the IMAP search standards but wondered if anyone could see if it's something that I'm doing that's wrong

asked Jan 08 '15 at 09:45

TheNeil's gravatar image


One thing to realize about the Imap.Search method is that the search string your app passed to it is sent unmodified to the IMAP server. Therefore, the format of the search criteria is defined by the IMAP specification (RFC 3501 at http://tools.ietf.org/html/rfc3501 ). If there are differences in IMAP server implementations then the behavior will be different. I would recommend reviewing section 6.4.4 of RFC 3501.

Given that AND is the default, you might try this: BODY "[TAG:" SINCE 01-Jan-2015

If Office365 doesn't return anything, then experiment. Does passing only "SINCE 01-Jan-2015" return anything? What about passing only BODY "[TAG:"?


answered Jan 08 '15 at 11:04

chilkat's gravatar image

chilkat ♦♦

I've been poking values at the various boxes all day (with quotes, without quotes, without the square brackets etc.) but not had any joy. Using your suggested search string, GMail opts to return everything sent since 1/1/15 regardless of whether it contains the tag text or not, whereas Office365 opts to return nothing at all.

If I remove the date filter (i.e. use only the body filter) it returns all emails (regardless of whether they contain tags on not) on both Gmail and Office365.

VERY annoying.

(Jan 08 '15 at 12:06) TheNeil

After poking values into the filter, using the BODY filter is totally unreliable across IMAP servers. The SUBJECT filter though works fine...which might explain why most email tags appear in the subject line.

Hopefully this'll save anyone else banging their head against this one


answered Jan 09 '15 at 06:43

TheNeil's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Jan 08 '15 at 09:45

Seen: 2,758 times

Last updated: Jan 09 '15 at 06:43

powered by OSQA