Closed himanshusagar closed 5 years ago
Did you find a solution to this problem. I'm looking for the same thing. It seems simple in NodJs https://github.com/jcreigno/nodejs-mail-notifier but there is no complete solution to be found on the net for python
Hi MaPoLom,
Hope your're doing well. As it turns out, it is not possible to be notified for new emails in python. Your only option is to check for new/unread emails via some library( easyimap ) every 5/10 mins.
It is definitely possible to do it with IMAPClient. A robust solution requires to use IMAP IDLE for notification and fallback to polling for mailboxes not supporting IDLE.
I used to listen for changes on thousands of mailboxes with a code similar to this one: https://github.com/mjs/imapclient/pull/324/files
Looking at nodejs-mail-notifier, it uses the 'mail' event from the imap package, which ultimately seems to be driven by IDLE
notifications.
Hi, Is it possible to run a thread and check emails continuously and see if there's a new one ? A naive way would be to run following inside while loop:
I am looking for something like login once and resynchronize with server for new unread emails? EDIT: I have tried IDLE mode using this and pulled UIDNEXT value of inbox folder. However, supplying same uid value(UIDNEXT) in server.fetch(), causes no results. I feel like i am missing some server.resynchronize_with_imap_server() command. Any thoughts?