0

My Node app is using imap module to retrieve emails:

var f = imap.seq.fetch('1:3', {
      bodies: ['HEADER.FIELDS (FROM TO SUBJECT DATE)', 'TEXT'],
      struct: true
    });

The app fetches emails with seqno 1-3 in gmail mail box. However I did not see those 3 emails in the mail box and only found them by searching the email subject. It seems the imap module retrieve some real old emails which are not visible in the mail box. I am wondering how seqno is issued in a mail box and weather a seqno for an email is unique and stay unchanged after issuing.

user938363
  • 9,990
  • 38
  • 137
  • 303
  • 2
    The sequence number (called MSN usually) is a numbering from 1 to the number of messages in the mailbox. When a new message arrives it gets a new higher number, when one is moved to another mailbox all the messages with higher MSNs are renumbered. Gmail's web interface generally shows the last few dozen messages, so those will tend to have large MSNs. – arnt Jan 10 '19 at 07:53
  • 1
    And no, MSNs are definitely not unique and will change as messages are deleted. The UID (unique ID) fills this role. – Max Jan 10 '19 at 14:25
  • The email retrieved by imap can not be seen in mail box and only available by searching the email subject. This puzzles me. I assume the fetch can only fetch the emails currently in the inbox, but not the ones moved or deleted out of inbox. – user938363 Jan 10 '19 at 21:32
  • Are they marked \Deleted? Fetch the FLAGS. – Max Jan 10 '19 at 21:42
  • The first email has \\SEEN in flags under attributes, the rest 2 have empty flags. – user938363 Jan 12 '19 at 13:21

0 Answers0