diff --git a/lib/imap.js b/lib/imap.js index 510da8c..0dca768 100644 --- a/lib/imap.js +++ b/lib/imap.js @@ -921,7 +921,10 @@ ImapConnection.prototype._fetch = function(which, uids, options) { if (extensions) cmd += extensions; cmd += 'UID FLAGS INTERNALDATE'; - cmd += (opts.request.struct ? ' BODYSTRUCTURE' : ''); + if (opts.request.struct) + cmd += ' BODYSTRUCTURE'; + if (opts.request.size) + cmd += ' RFC822.SIZE'; if (toFetch !== undefined) { cmd += ' BODY'; if (!opts.markSeen) diff --git a/lib/imap.parsers.js b/lib/imap.parsers.js index c86d764..20dca43 100644 --- a/lib/imap.parsers.js +++ b/lib/imap.parsers.js @@ -59,6 +59,8 @@ exports.parseFetch = function(str, literals, fetchData) { fetchData.flags = result[i+1].filter(utils.isNotEmpty); else if (result[i] === 'BODYSTRUCTURE') fetchData.structure = exports.parseBodyStructure(result[i+1], literals); + else if (result[i] === 'RFC822.SIZE') + fetchData.size = parseInt(result[i+1], 10); else if (typeof result[i] === 'string') // simple extensions fetchData[result[i].toLowerCase()] = result[i+1]; }