emailjs / emailjs-imap-client

Low-level JS IMAP client for all your IMAP needs.
MIT License
552 stars 123 forks source link

UID passed in and UID received are not equal #255

Open duypham9895 opened 3 years ago

duypham9895 commented 3 years ago
Screen Shot 2021-07-21 at 09 33 17

I was passed the range of UID 1:* then I received the range of UID 35:*. I met a lot of problems with them. Can anybody explain why, please. Thank you for your time & support.

cuuupid commented 3 years ago

Most likely means UIDs 1-34 do not exist on the mailserver. UIDs are not continuous on the mailserver (this can cause certain bugs with mailservers, if you try to fetch a sequence of UIDs that no longer exist at all on the server it may never respond if it is configured poorly).

Please also note that * means the last known message and sequences are not strictly increasing. For example, if you fetch 68:* and the newest message on the mailserver is UID 67, this translates to 68:67 and will thus return the message with UID 67 even though it numerically precedes 68.

BTW - GMail has strict limits for IMAP operations. I highly recommend avoiding fetching 1:* or really anything above 500-1000 messages at a time or their server will misbehave. In our tests we found fetching blocks of 500 messages resulted in the most consistent behaviour.