Alex Rivera | Logout

Getting only new mail from an IMAP server

Asked 2009-07-05T20:37:55.230
21

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.

I could use SEARCH with SINCE DATE, but there's no support for time + date could be easily spoofed.

I also tried the RECENT flag, but that doesn't seem to work with gmail (in ruby it shows nil everytime).

Edit
Report

1 Answer

0

If you are you able to filter incoming mail into a specific IMAP folder on the server side, your app can read new messages in that folder and then move them into the standard INBOX folder after it's done.

answered 2009-07-05T23:03:44.157

Your Answer