node-imap icon indicating copy to clipboard operation
node-imap copied to clipboard

How to get uid of email ?

Open waqas1991 opened this issue 12 years ago • 2 comments

I have the following code I also want uid with seqno. is there is any way to do this ?

var f = self.imap.fetch(results, { bodies: '', markSeen: self.markSeen });
            f.on('message', function(msg, seqno) {
                var parser = new MailParser();
                parser.on("end", function(mail) {
                    self.emit('mail',mail,seqno);
                });
                msg.on('body', function(stream, info) {
                    stream.pipe(parser);
                });
            });

Thanks in advance.

waqas1991 avatar May 16 '14 05:05 waqas1991

You can add:

msg.on('attributes', function(attrs) {
  console.log('uid = ' + attrs.uid);
});

inside your 'message' event handler.

mscdex avatar May 16 '14 11:05 mscdex

Thanks Man ! It worked

waqas1991 avatar May 16 '14 12:05 waqas1991