Fetch error: Error: The specified message set is invalid. !!
See original GitHub issueI am trying the following code to fetch Hotmail/outlook emails :
var Imap = require("imap"),
inspect = require("util").inspect;
var imap = new Imap({
user: "myemail@hotmail.com",
password: "mypassword",
host: "imap-mail.outlook.com",
port: 993,
tls: true
});
function openInbox(cb) {
imap.openBox("INBOX", true, cb);
}
imap.once("ready", function() {
openInbox(function(err, box) {
if (err) throw err;
var f = imap.seq.fetch(`*`, {
bodies: "HEADER.FIELDS (FROM TO SUBJECT DATE)",
struct: true
});
f.on("message", function(msg, seqno) {
console.log("Message #%d", seqno);
var prefix = "(#" + seqno + ") ";
msg.on("body", function(stream, info) {
var buffer = "";
stream.on("data", function(chunk) {
buffer += chunk.toString("utf8");
});
stream.once("end", function() {
console.log(
prefix + "Parsed header: %s",
inspect(Imap.parseHeader(buffer))
);
});
});
msg.once("attributes", function(attrs) {
console.log(prefix + "Attributes: %s", inspect(attrs, false, 8));
});
msg.once("end", function() {
console.log(prefix + "Finished");
});
});
f.once("error", function(err) {
console.log("Fetch error: " + err);
});
f.once("end", function() {
console.log("Done fetching all messages!");
imap.end();
});
});
});
imap.once("error", function(err) {
console.log(err);
});
imap.once("end", function() {
console.log("Connection ended");
});
imap.connect();
But, I’m getting the following error :
Fetch error: Error: The specified message set is invalid.
Done fetching all messages!
Connection ended
@mscdex please help !!
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Expunge caused "BAD Protocol Error: "Specified message set ...
Hi there. I have a bit trouble with JavaMail 1.4.1. I think, I use it in the wrong way, but I get no...
Read more >imap - "The specified message set is invalid (NO)" Exception ...
First I am processing all the messages I get back in the Bounce Result collection and collecting all the Sequence ID's I Want...
Read more >Server Replied: No the specified message set is invalid. - MSDN
im: <= 'A7 NO The specified message set is invalid. ' Fetch error: Error: The specified message set is invalid. Done fetching all...
Read more >IMAP FETCH (Exchange) returns "Invalid message set in ...
The mail server responded: Protocol Error: "Invalid message set in FETCH command".' Closing all Mozilla windows and restarting enables mail to function ...
Read more >IMAP Error: command FETCH: Invalid messageset
Error in IMAP command FETCH: Invalid messageset: This error is caused by a well-known bug in the IMAP implementation used by your email...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mscdex Done, the problem was with the source range, I used
imap.seq.fetch("*", options)
and worked with gmail but it didn’t work with hotmail/outlook so i changed it to “1:*” Relates #615Ah ok, yeah not all server IMAP implementations behave correctly, especially outlook/exchange from what I’ve seen in the past.