mscdex / node-imap

An IMAP client module for node.js.
MIT License
2.17k stars 382 forks source link

Retrieve UID from SEQNO #776

Closed gustavohstrassburger closed 5 years ago

gustavohstrassburger commented 5 years ago

Hey there,

I'm facing an issue that I do not know how to solve at this point. I need to sync the flags (mostly if the email was seen) between my application and the email server. To do so, I'm listening to the update event, however, I do not keep track of the SEQNO, only the UID, but this event doesn't seem to give me such information.

Do you have any suggestions on how to proceed?

Thanks in advance.

mscdex commented 5 years ago

You would need to fetch() by sequence number with just the basics (no bodies for example) to get the new flags and the UID.

gustavohstrassburger commented 5 years ago

I see, and is it possible to filter a specific SEQNO like I do it with the UID on the search method?

E.g: ['UID', `${uidvalidity}:*`]

Thanks so much.

mscdex commented 5 years ago

Since you already have the sequence number from the 'update' event, you can just pass that to imap.seq.fetch() without doing a search first.

gustavohstrassburger commented 5 years ago

Thanks, It worked.