Fast scan of emails using IMAP protocol

121 Views Asked by At

I am using IMAP protocol to scan emails for my inbox. Want to write an application which will have all my newsletter sorted.

What I notice that it is get 1 sec for scan 1 email. But how service like UnRoll.me do in in 2 min? Any suggestion? Thanks

1

There are 1 best solutions below

0
Max On

[psychic debugging hat on]

Likely, you are fetching messages one at a time, rather than sending requests for hundreds of messages at a time. The FETCH can take a large list of (U)IDs, and you can get hundreds of responses for the cost of one network round trip:

 A001 FETCH 1:1000 (FLAGS BODY[HEADER.FIELDS (.....)])