title: Python IMAP - search by headers
body: <p>I am using Python's <a href="http://imapclient.readthedocs.io/en/master/" rel="nofollow noreferrer">IMAPClient</a> in my mail client, and basically I am stuck trying to look up messages by their headers. Specifically, I am trying to find all messages with a given <code>in_reply_to</code> value, which is part of <code>ENVELOPE</code>. </p>
  
  <p>I have tried the following, but none of them works.</p>
  
  <pre><code>server.select_folder(folder_name)
  server.search(['ENVELOPE[IN_REPLY_TO]', 'my_target_value'])
  #server.search(['ENVELOPE.IN_REPLY_TO', 'my_target_value'])
  #server.search(['IN_REPLY_TO', 'my_target_value'])
  </code></pre>
  
  <p>Any ideas how to do that?</p>