chadxz / imap-simple

Wrapper over node-imap, providing a simpler api for common use cases
MIT License
243 stars 80 forks source link

Search gives duplicates #76

Closed abstractmatter closed 3 years ago

abstractmatter commented 4 years ago

Hi!

I experience a strange bug since last update to 5.0.0: search() send back duplicates message.

I'm not sure it's related to imap-simple or node-imap or… the imap server.

with a search like this in a particular box (not the INBOX):

connexion.search([ 'ALL' ],  { bodies: [ '' ], markSeen: false });

If I have one message in the mailbox, it returns 2 messages with 2 different seqNo (always sequential) but the same messageId.

For now, I filter out the duplicates, it solve my problem, but I wanted to know if you experienced something like this before.

Just for testing I logged the fetchOnMessage in the lib, and indeed it receive all the messages twice. If I change the .on('message', …) to `.once('message',…), it send back only one message but does not finish the process.

abstractmatter commented 4 years ago

Oh, 😅… great lib by the way 😁really helpful, many thanks!

ghost commented 4 years ago

Sounds like either a problem with your service provider or a underlaying problem with node-imap. Since you said seqNo is different then it is more likely your service provider is doing something strange.