title: IMAP: Search for messages with UID greater than X (or generally, after my last search)
body: <p>I'm writing a script to analyze my mailbox and want to periodically check for new messages. The search criteria would be: give me the UIDs for all emails with UID greater than X, where X is the UID of the last email I processed.</p>
  
  <p>Or, more generally, I'm looking for a way to only see messages since my last search.</p>
  
  <p>Note that I'm not looking for seen/unseen messages; the script opens the mailbox as read-only, and I'd like it to not interfere with my flags, etc.</p>
  
  <p>I know I can specify a date in the IMAP search, but the granularity of that seems to be by day, so not exactly what I need.</p>
  
  <p>I'm starting with Gmail as the IMAP server, but would like to support generic IMAP servers in the future.</p>
  
  <p>Is there way to search for emails with UID greater than X? Or another means of specify all messages since message X?</p>