Alex Rivera | Logout

How do I enable push-notification for IMAP (Gmail) using Python imaplib?

Asked 2009-01-07T17:13:32.863
29

Is there a way to monitor a gmail account using imaplib without polling gmail each time I want to see if there is new mail. Or in other words, I just want the script to be notified of a new message so I can process it right away instead of any lag time between polls.

I see that the IMAP protocol supports this with the IDLE command, but I can't see anything documented with it in the imaplib docs, so any help with this would be great!

Edit
Report

1 Answer

4

This link shows an example of using IMAP IDLE: http://blog.timstoop.nl/2009/03/11/python-imap-idle-with-imaplib2/

It uses the same library linked to in casperOne's answer (imaplib2).

answered 2011-01-28T21:23:28.717

Your Answer