-
Notifications
You must be signed in to change notification settings - Fork 170
Description
I have an IMAP inbox and I want to listen for incoming mail. IMAP-wise, this can be done with the IDLE command. What would be the best way to implement this in Django Mailbox?
Currently, Django Mailbox uses imaplib, which doesn't natively support IDLE. One solution monkey patches imaplib. While monkey-patching is generally undesirable, the solution looks minimally invasive. (Note that I haven't delved into the implementation details of IDLE or tested this code.)
There's also an imaplib2 module (src) which supports IDLE, and replaces imaplib (with caveats). Yet changing modules seem more invasive that the monkey patch above.
As far as Django Mailbox goes, maybe a watch()
method could be added to the ImapTransport class and run with a management command?
conn = mailbox.get_connection()
conn.watch()