title: Python Gmail IMAP After a certain date
body: <p>I am trying to use python IMAP to access my gmail but I want to read only the messages after a certain date. I've narrowed it down to the search portion but I use On and before in the search and it is successful only the after doesn't work. is there a way to retrieve emails after a certain date or will i need to read them all and compare dates? </p>
  
  <pre><code>typ, data = conn.search(None, "After 12/12/18")
  
  try:
      for num in data[0].split():
          typ, msg_data = conn.fetch(num, '(RFC822)')
          for response_part in msg_data:
              if isinstance(response_part, tuple):
                  msg = email.message_from_bytes(response_part[1])
                  subject=msg['subject']
                  by = msg['from']
                  to = msg['to']
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>imaplib.IMAP4.error: SEARCH command error: BAD [b'Could not parse command']
  </code></pre>