diff --git a/README.md b/README.md index 12b6ce4..5d2d538 100644 --- a/README.md +++ b/README.md @@ -576,6 +576,7 @@ Connection Instance Methods * **envelope** - _boolean_ - Fetch the message envelope. **Default:** false * **size** - _boolean_ - Fetch the RFC822 size. **Default:** false * **modifiers** - _object_ - Fetch modifiers defined by IMAP extensions. **Default:** (none) + * **extensions** - _array_ - Fetch custom fields defined by IMAP extensions, e.g. ['X-MAILBOX', 'X-REAL-UID']. **Default:** (none) * **bodies** - _mixed_ - A string or Array of strings containing the body part section to fetch. **Default:** (none) Example sections: * 'HEADER' - The message header diff --git a/lib/Connection.js b/lib/Connection.js index c6c4149..b2964a3 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -815,6 +815,11 @@ Connection.prototype._fetch = function(which, uids, options) { fetching.push('BODYSTRUCTURE'); if (options.size) fetching.push('RFC822.SIZE'); + if (Array.isArray(options.extensions)) { + options.extensions.forEach(function (extension) { + fetching.push(extension.toUpperCase()); + }); + } cmd += fetching.join(' '); if (options.bodies !== undefined) { var bodies = options.bodies,