Archived Forum Post

Index of archived forum posts


IMAP Search for Replies

Oct 09 '17 at 08:44

I need to search emails that are not from a Domain (I already do this) and that are not replies of emails.

I use CkImap_Search , and for the search Criteria I will use fristCriteria + « AND » and the secondCriteria.

I need you feedback( for the secondCriteria) of the best way to filter message that are replies.

I was thinking of subject begining with ‘Re : ‘ but that’s maybe not the clever way to check this.

What’s your thought ?


One possibility is to search for the presence of the "In-Reply-To" header field. Usually, an email that is a reply will contain this header. For example:

In-Reply-To: <>
You should be able to use the HEADER keyword in the search expression. (Remember, the Search Expression you pass to the IMAP server is not interpreted by Chilkat. It is passed directly to the IMAP server. The rules for the IMAP search expressions and how they are (or should be) interpreted by an IMAP server are described in RFC 3501, and this is reproduced in the Chilkat reference documentation. But beware, different IMAP server implementations may behave differently, or may implement only subsets of the SEARCH functionality. (For example, full-text BODY searches may be limited for the fact that searches on huge mailboxes would result in heavy loads on the server.)


Thanks Mat for your reply. In my case I don't know the reply because I want to exclude all replyed mails. Do something like NOT HEADER In-Reply-To "" should work ? Best regards