We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
I am using nodejs Imap module to read email, but from yesterday i.e. 11 Dec 2014, I am getting error
"Some messages could not be FETCHed (Failure)",
my code is something like
imap.once('ready', function () { imap.openBox("[Gmail]/All Mail", true, function (err, box) { if (err) { d.reject(err); } var Moment = require("moment"); var sDate = Moment(startDate).format("MMMM DD, YYYY"); var mailSearchOptions = []; if (params.mailSearchOptions) { mailSearchOptions = params.mailSearchOptions } else { mailSearchOptions.push(['SINCE', sDate]); if (uid) { mailSearchOptions.push(["uid", uid + ":*"]) } } try { imap.search(mailSearchOptions, function (err, results) { if (err) { d.reject(err); return } if (!results || (Array.isArray(results) && results.length == 0)) { d.reject(err); return; } var f = imap.fetch(results, { bodies: ['HEADER.FIELDS (TO FROM SUBJECT CC)', '1', '1.1', "1.2"], struct: true }); f.on('message', function (msg, seqno) { var mailDate = false; var head = ""; var bodyText = {}; var struct = undefined; msg.on("body", function (stream, info) { stream.on('data', function (chunk) { if (info.which == 'HEADER.FIELDS (TO FROM SUBJECT CC)') { head += chunk.toString('utf8'); } else { if (bodyText[info.which] === undefined) { bodyText[info.which] = ""; } bodyText[info.which] += chunk.toString('utf8'); } }); stream.once('end', function () { if (info.which == 'HEADER.FIELDS (TO FROM SUBJECT CC)') { head = require("imap").parseHeader(head); } }); }); msg.once('attributes', function (attrs) { struct = attrs.struct; lastUid = attrs.uid; mailDate = attrs.date; }); msg.once('end', function () { if (!uid || (uid && lastUid !== parseInt(uid))) { var bodyValue = ""; var bodyType = ""; var toPrefer = "1.1" if ((!(bodyText[toPrefer])) || bodyText[toPrefer] == "null" || bodyText[toPrefer] == null || bodyText[toPrefer].toString().trim().length == 0) { bodyValue = bodyText["1"]; bodyType = "1"; } else { bodyValue = bodyText[toPrefer]; bodyType = toPrefer; } var encoding = getEncoding(struct, bodyType); if (encoding && encoding == "BASE64") { bodyValue = new Buffer(bodyValue, "base64").toString(); } formatEmails(head); head.subject = head.subject ? head.subject[0] : ""; var participants = []; populateParticipants(head, username, participants); mails.push({head: head, body: bodyValue, date: mailDate, participants: participants, user: {_id: userid, username: username}, uid: lastUid}); } }); }); f.once('error', function (err) { console.log("error>>>>>>>>>>>"+err) ; d.reject(err); }); f.once('end', function () { if (!params.maintainLogs) { return updateLastUid(lastUid, uid, userid, db).then(function () { imap.end(); }); } else { imap.end(); } }); }); } catch (e) { console.log("error>>>catch>>>>>>>>"+err) ; d.reject(e); } }); }); imap.once('error', function (err) { d.reject(err); }); imap.once('end', function () { d.resolve(mails); }); imap.connect(); });>
I have checked and found, if I remove '1.1' and '1.2' from
var f = imap.fetch(results, { bodies: ['HEADER.FIELDS (TO FROM SUBJECT CC)', '1', '1.1', "1.2"], struct: true });
which then becomes
var f = imap.fetch(results, { bodies: ['HEADER.FIELDS (TO FROM SUBJECT CC)', '1'], struct: true });
does not gives me error, but by removing this I am not getting the appropriate email data,
Everything is working fine before yesterday...
Please help...
The text was updated successfully, but these errors were encountered:
My guess is that you recently received new emails that do not have the parts you're requesting.
Sorry, something went wrong.
please close this issue, Currently I have no use of this..
No branches or pull requests
Hello,
I am using nodejs Imap module to read email, but from yesterday i.e. 11 Dec 2014, I am getting error
"Some messages could not be FETCHed (Failure)",
my code is something like
I have checked and found, if I remove '1.1' and '1.2' from
var f = imap.fetch(results, { bodies: ['HEADER.FIELDS (TO FROM SUBJECT CC)', '1', '1.1', "1.2"], struct: true });
which then becomes
var f = imap.fetch(results, { bodies: ['HEADER.FIELDS (TO FROM SUBJECT CC)', '1'], struct: true });
does not gives me error, but by removing this I am not getting the appropriate email data,
Everything is working fine before yesterday...
Please help...
The text was updated successfully, but these errors were encountered: