Global

Type Definitions

AppendResponseObject :Object

Properties:
Name Type Attributes Description
destination String

full mailbox path where the message was uploaded to

uidValidity BigInt <optional>

mailbox UIDVALIDITY if server has UIDPLUS extension enabled

uid Number <optional>

UID of the uploaded message if server has UIDPLUS extension enabled

seq Number <optional>

sequence number of the uploaded message if path is currently selected mailbox

CopyResponseObject :Object

Properties:
Name Type Attributes Description
path String

path of source mailbox

destination String

path of destination mailbox

uidValidity BigInt <optional>

destination mailbox UIDVALIDITY if server has UIDPLUS extension enabled

uidMap Map.<number, number> <optional>

Map of UID values (if server has UIDPLUS extension enabled) where key is UID in source mailbox and value is the UID for the same message in destination mailbox

DownloadObject :Object

Properties:
Name Type Description
meta Object

content metadata

Properties
Name Type Attributes Description
expectedSize number

The fetch response size

contentType String

Content-Type of the streamed file. If part was not set then this value is "message/rfc822"

charset String <optional>

Charset of the body part. Text parts are automaticaly converted to UTF-8, attachments are kept as is

disposition String <optional>

Content-Disposition of the streamed file

filename String <optional>

Filename of the streamed body part

content ReadableStream

Streamed content

FetchMessageObject :Object

Fetched message data

Properties:
Name Type Attributes Description
seq Number

message sequence number. Always included in the response

uid Number

message UID number. Always included in the response

source Buffer <optional>

message source for the requested byte range

modseq BigInt <optional>

message Modseq number. Always included if the server supports CONDSTORE extension

emailId String <optional>

unique email ID. Always included if server supports OBJECTID or X-GM-EXT-1 extensions

threadid String <optional>

unique thread ID. Only present if server supports OBJECTID or X-GM-EXT-1 extension

labels Set.<string> <optional>

a Set of labels. Only present if server supports X-GM-EXT-1 extension

size Number <optional>

message size

flags Set.<string> <optional>

a set of message flags

flagColor String <optional>

flag color like "red", or "yellow". This value is derived from the flags Set and it uses the same color rules as Apple Mail

envelope MessageEnvelopeObject <optional>

message envelope

bodyStructure MessageStructureObject <optional>

message body structure

internalDate Date <optional>

message internal date

bodyParts Map.<string, Buffer> <optional>

a Map of message body parts where key is requested part identifier and value is a Buffer

headers Buffer <optional>

Requested header lines as Buffer

FetchQueryObject :Object

Properties:
Name Type Attributes Description
uid Boolean <optional>

if true then include UID in the response

flags Boolean <optional>

if true then include flags Set in the response. Also adds flagColor to the response if the message is flagged.

bodyStructure Boolean <optional>

if true then include parsed BODYSTRUCTURE object in the response

envelope Boolean <optional>

if true then include parsed ENVELOPE object in the response

internalDate Boolean <optional>

if true then include internal date value in the response

size Boolean <optional>

if true then include message size in the response

source boolean | Object <optional>

if true then include full message in the response

Properties
Name Type Attributes Description
start Number <optional>

include full message in the response starting from start byte

maxLength Number <optional>

include full message in the response, up to maxLength bytes

threadId String <optional>

if true then include thread ID in the response (only if server supports either OBJECTID or X-GM-EXT-1 extensions)

labels Boolean <optional>

if true then include GMail labels in the response (only if server supports X-GM-EXT-1 extension)

headers boolean | Array.<string> <optional>

if true then includes full headers of the message in the response. If the value is an array of header keys then includes only headers listed in the array

bodyParts Array.<string> <optional>

An array of BODYPART identifiers to include in the response

IdInfoObject :Object

Client and server identification object, where key is one of RFC2971 defined data fields (but not limited to).

Properties:
Name Type Attributes Description
name String <optional>

Name of the program

version String <optional>

Version number of the program

os String <optional>

Name of the operating system

vendor String <optional>

Vendor of the client/server

'support-url' String <optional>

URL to contact for support

date Date <optional>

Date program was released

ListResponse :Object

Properties:
Name Type Attributes Description
path String

mailbox path (unicode string)

pathAsListed String

mailbox path as listed in the LIST/LSUB response

name String

mailbox name (last part of path after delimiter)

delimiter String

mailbox path delimiter, usually "." or "/"

parent Array.<string>

An array of parent folder names. All names are in unicode

parentPath String

Same as parent, but as a complete string path (unicode string)

flags Set.<string>

a set of flags for this mailbox

specialUse String

one of special-use flags (if applicable): "\All", "\Archive", "\Drafts", "\Flagged", "\Junk", "\Sent", "\Trash". Additionally INBOX has non-standard "\Inbox" flag set

listed Boolean

true if mailbox was found from the output of LIST command

subscribed Boolean

true if mailbox was found from the output of LSUB command

status StatusObject <optional>

If statusQuery was used, then this value includes the status response

ListTreeResponse :Object

Properties:
Name Type Description
root Boolean

If true then this is root node without any additional properties besides folders

path String

mailbox path

name String

mailbox name (last part of path after delimiter)

delimiter String

mailbox path delimiter, usually "." or "/"

flags array

list of flags for this mailbox

specialUse String

one of special-use flags (if applicable): "\All", "\Archive", "\Drafts", "\Flagged", "\Junk", "\Sent", "\Trash". Additionally INBOX has non-standard "\Inbox" flag set

listed Boolean

true if mailbox was found from the output of LIST command

subscribed Boolean

true if mailbox was found from the output of LSUB command

disabled Boolean

If true then this mailbox can not be selected in the UI

folders Array.<ListTreeResponse>

An array of subfolders

MailboxCreateResponse :Object

Properties:
Name Type Attributes Description
path String

full mailbox path

mailboxId String <optional>

unique mailbox ID if server supports OBJECTID extension (currently Yahoo and some others)

created Boolean

If true then mailbox was created otherwise it already existed

MailboxDeleteResponse :Object

Properties:
Name Type Description
path String

full mailbox path that was deleted

MailboxLockObject :Object

Properties:
Name Type Description
path String

mailbox path

release function

Release current lock

Example
let lock = await client.getMailboxLock('INBOX');
try {
  // do something in the mailbox
} finally {
  // use finally{} to make sure lock is released even if exception occurs
  lock.release();
}

MailboxObject :Object

Properties:
Name Type Attributes Description
path String

mailbox path

delimiter String

mailbox path delimiter, usually "." or "/"

flags Set.<string>

list of flags for this mailbox

specialUse String <optional>

one of special-use flags (if applicable): "\All", "\Archive", "\Drafts", "\Flagged", "\Junk", "\Sent", "\Trash". Additionally INBOX has non-standard "\Inbox" flag set

listed Boolean

true if mailbox was found from the output of LIST command

subscribed Boolean

true if mailbox was found from the output of LSUB command

permanentFlags Set.<string>

A Set of flags available to use in this mailbox. If it is not set or includes special flag "\*" then any flag can be used.

mailboxId String <optional>

unique mailbox ID if server has OBJECTID extension enabled

highestModseq BigInt <optional>

latest known modseq value if server has CONDSTORE or XYMHIGHESTMODSEQ enabled

noModseq String <optional>

if true then the server doesn't support the persistent storage of mod-sequences for the mailbox

uidValidity BigInt

Mailbox UIDVALIDITY value

uidNext Number

Next predicted UID

exists Number

Messages in this folder

MailboxRenameResponse :Object

Properties:
Name Type Description
path String

full mailbox path that was renamed

newPath String

new full mailbox path

MessageAddressObject :Object

Parsed email address entry

Properties:
Name Type Attributes Description
name String <optional>

name of the address object (unicode)

address String <optional>

email address

MessageEnvelopeObject :Object

Parsed IMAP ENVELOPE object

Properties:
Name Type Attributes Description
date Date <optional>

header date

subject String <optional>

message subject (unicode)

messageId String <optional>

Message ID of the message

inReplyTo String <optional>

Message ID from In-Reply-To header

from Array.<MessageAddressObject> <optional>

Array of addresses from the From: header

sender Array.<MessageAddressObject> <optional>

Array of addresses from the Sender: header

replyTo Array.<MessageAddressObject> <optional>

Array of addresses from the Reply-To: header

to Array.<MessageAddressObject> <optional>

Array of addresses from the To: header

cc Array.<MessageAddressObject> <optional>

Array of addresses from the Cc: header

bcc Array.<MessageAddressObject> <optional>

Array of addresses from the Bcc: header

MessageStructureObject :Object

Parsed IMAP BODYSTRUCTURE object

Properties:
Name Type Attributes Description
part String

Body part number. This value can be used to later fetch the contents of this part of the message

type String

Content-Type of this node

parameters Object <optional>

Additional parameters for Content-Type, eg "charset"

id String <optional>

Content-ID

encoding String <optional>

Transfer encoding

size Number <optional>

Expected size of the node

envelope MessageEnvelopeObject <optional>

message envelope of embedded RFC822 message

disposition String <optional>

Content disposition

dispositionParameters Object <optional>

Additional parameters for Conent-Disposition

childNodes Array.<MessageStructureObject>

An array of child nodes if this is a multipart node. Not present for normal nodes

QuotaResponse :Object

Properties:
Name Type Attributes Default Description
path String INBOX

mailbox path this quota applies to

storage Object <optional>

Storage quota if provided by server

Properties
Name Type Attributes Description
used Number <optional>

used storage in bytes

limit Number <optional>

total storage available

messages Object <optional>

Message count quota if provided by server

Properties
Name Type Attributes Description
used Number <optional>

stored messages

limit Number <optional>

maximum messages allowed

SearchObject :Object

IMAP search query options. By default all conditions must match. In case of or query term at least one condition must match.

Properties:
Name Type Attributes Description
seq SequenceString <optional>

message ordering sequence range

answered Boolean <optional>

Messages with (value is true) or without (value is false) \Answered flag

deleted Boolean <optional>

Messages with (value is true) or without (value is false) \Deleted flag

draft Boolean <optional>

Messages with (value is true) or without (value is false) \Draft flag

flagged Boolean <optional>

Messages with (value is true) or without (value is false) \Flagged flag

seen Boolean <optional>

Messages with (value is true) or without (value is false) \Seen flag

all Boolean <optional>

If true matches all messages

new Boolean <optional>

If true matches messages that have the \Recent flag set but not the \Seen flag

old Boolean <optional>

If true matches messages that do not have the \Recent flag set

recent Boolean <optional>

If true matches messages that have the \Recent flag set

from String <optional>

Matches From: address field

to String <optional>

Matches To: address field

cc String <optional>

Matches Cc: address field

bcc String <optional>

Matches Bcc: address field

body String <optional>

Matches message body

subject String <optional>

Matches message subject

larger Number <optional>

Matches messages larger than value

smaller Number <optional>

Matches messages smaller than value

uid SequenceString <optional>

UID sequence range

modseq BigInt <optional>

Matches messages with modseq higher than value

emailId String <optional>

unique email ID. Only used if server supports OBJECTID or X-GM-EXT-1 extensions

threadId String <optional>

unique thread ID. Only used if server supports OBJECTID or X-GM-EXT-1 extensions

before Date | string <optional>

Matches messages received before date

on Date | string <optional>

Matches messages received on date (ignores time)

since Date | string <optional>

Matches messages received after date

sentBefore Date | string <optional>

Matches messages sent before date

sentOn Date | string <optional>

Matches messages sent on date (ignores time)

sentSince Date | string <optional>

Matches messages sent after date

keyword String <optional>

Matches messages that have the custom flag set

unKeyword String <optional>

Matches messages that do not have the custom flag set

header Object.<string, (Boolean|String)> <optional>

Mathces messages with header key set if value is true (NB! not supported by all servers) or messages where header partially matches a string value

or Array.<SearchObject> <optional>

An array of 2 or more SearchObject objects. At least on of these must match

SequenceString :String

Sequence range string. Separate different values with commas, number ranges with colons and use \* as the placeholder for the newest message in mailbox

Example
"1:*" // for all messages
"1,2,3" // for messages 1, 2 and 3
"1,2,4:6" // for messages 1,2,4,5,6
"*" // for the newest message

StatusObject :Object

Properties:
Name Type Attributes Description
path String

full mailbox path that was checked

messages Number <optional>

Count of messages

recent Number <optional>

Count of messages with \Recent tag

uidNext Number <optional>

Predicted next UID

uidValidity BigInt <optional>

Mailbox UIDVALIDITY value

unseen Number <optional>

Count of unseen messages

highestModseq BigInt <optional>

Last known modseq value (if CONDSTORE extension is enabled)