I am developing an application where users add their Gmail accounts, and I do some classification work on their emails.
I want to be notified when a new email comes to any of the registered accounts.
A solution is to keep polling the accounts via IMAP and saving the last email date I have fetched to check whether there is a new mail or not, but this has a lot of overhead.
Any idea how to monitor Gmail and be notified when a new email is received and integrate this with a Rails app? Is there an extension which can do that and send a post request to my Rails application for example?