Skip to content

Best way to implement IMAP IDLE? #186

@TravisDart

Description

@TravisDart

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions