emailjs / emailjs-imap-client

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

how to get new messages first on listMessages? #215

Open ghost opened 5 years ago

ghost commented 5 years ago

listMessages methods always return sorted by date asc

MarcoCatalan commented 4 years ago

What sequence are you giving it? According to the RFC the sequence is defined as:

seq-range       = seq-number ":" seq-number
                    ; two seq-number values and all values between
                    ; these two regardless of order.
                    ; Example: 2:4 and 4:2 are equivalent and indicate
                    ; values 2, 3, and 4.
                    ; Example: a unique identifier sequence range of
                    ; 3291:* includes the UID of the last message in
                    ; the mailbox, even if that value is less than 3291.

I haven't been able to find anything about how the server should order messages, so I guess the server can do it as it wants (Although I haven't found a server with doesn't order messages by ascending sequence number)