title: Getting only new mail from an IMAP server
body: <p>I am writing a client application that fetches emails from an IMAP server and then stores them in a database. The problem is that once I have checked the mail, the next time I only want to download the mail that has arrived since. So if I had checked the server for mail two hour ago, I only want to get the mail that has arrived in the last two hours.</p>
  
  <p>I could use SEARCH with SINCE DATE, but there's no support for time + date could be easily spoofed.</p>
  
  <p>I also tried the RECENT flag, but that doesn't seem to work with gmail (in ruby it shows nil everytime).</p>