Search code examples
chilkat-email

Chilkat: How to check for respones to a given email - Original-Envelope-Id


I have MESSAGE-ID from email which I send. How to filter email in IMAP "all mailboxes" to fined email which are response to my MESSAGE-ID . Currently I know that in response I need to look for "Original-Envelope-Id".

But how to do this with Chilkat ?

Do I need to use $imap.Search(....) https://www.chilkatsoft.com/refdoc/csImapRef.html#method70 ?

With:

  UID 
     Messages with unique identifiers corresponding to the specified
     unique identifier set.  Sequence set ranges are permitted.

?

btw. I already check this example https://www.example-code.com/powershell/imap_search.asp

But he is not related to search for email response.


Solution

  • Chilkat is passing the search criteria string to the IMAP server unmodified. Therefore, it's really just a matter of understanding the IMAP specification for search criteria as documented in RFC 3501 here: https://www.rfc-editor.org/rfc/rfc3501#section-6.4.4

    If you look at the RFC, this is the way to specify a search for a particular header field:

      HEADER <field-name> <string>
         Messages that have a header with the specified field-name (as
         defined in [RFC-2822]) and that contains the specified string
         in the text of the header (what comes after the colon).  If the
         string to search is zero-length, this matches all messages that
         have a header line with the specified field-name regardless of
         the contents.
    

    However.. my experience is that most IMAP server implementations don't implement all possible SEARCH criteria options.