Skip to main content

MailboxJs

MailboxJs

MailboxJS Used to interact with a mailbox by IMAP or/and SMTP

Kind: global class

new MailboxJs(config)

Contructor of MailboxJS

ParamTypeDescription
configMailboxJsConfigConfiguration of MailboxJS

mailboxJs.run() ⇒ MailboxJs

Run MailboxJS You should await for this method before any actions on MailboxJS object

Kind: instance method of MailboxJs

mailboxJs.on(event, callback)

Event listener for MailboxJS

Kind: instance method of MailboxJs

ParamTypeDescription
event'mail' | 'delete'Event you want to listen to
callbackfunctionFunction to call when event triggered (give you an email for 'mail' event and uid for 'delete' event)

mailboxJs.send(to, subject, text, attachments, from)

Send a mail

Kind: instance method of MailboxJs

ParamTypeDescription
tostringReceiver identity
subjectstringSubject of the mail
textstringContent text of the mail
attachmentsArray.<Attachment>Mail attachments
fromstringSender identity

mailboxJs.sendHtml(to, subject, text, html, attachments, from)

Send a html mail

Kind: instance method of MailboxJs

ParamTypeDescription
tostringReceiver identity
subjectstringSubject of the mail
textstringContent text of the mail
htmlstringContent html of the mail
attachmentsArray.<Attachment> | AttachmentMail attachments
fromstringSender identity

mailboxJs.getMailboxes() ⇒ Map.<string, Mailbox>

Get mailboxes map

Kind: instance method of MailboxJs
Returns: Map.<string, Mailbox> - - A map of Mailbox objects

mailboxJs.createMailbox(mailboxPath) ⇒ Promise.<(MailboxCreateResponse|undefined)>

Create a mailbox

Kind: instance method of MailboxJs

ParamTypeDescription
mailboxPathstringMailbox's name to create

mailboxJs.deleteMailbox(mailboxPath) ⇒ Promise.<(MailboxDeleteResponse|undefined)>

Delete a mailbox

Kind: instance method of MailboxJs

ParamTypeDescription
mailboxPathstringMailbox's name to delete

mailboxJs.renameMailbox(mailboxPath, newMailboxPath) ⇒ Promise.<(MailboxRenameResponse|undefined)>

Rename a mailbox

Kind: instance method of MailboxJs

ParamTypeDescription
mailboxPathstringMailbox's name to rename
newMailboxPathstringNew mailbox's name

mailboxJs.copyMails(mailboxPath, toMailboxPath, toCopy) ⇒ Promise.<(CopyResponseObject|undefined)>

Copy one or multiple mails

Kind: instance method of MailboxJs

ParamTypeDescription
mailboxPathstringMailbox's name
toMailboxPathstringTo mailbox's name
toCopyUidsListList of mails to copy

mailboxJs.moveMails(mailboxPath, toMailboxPath, toMove) ⇒ Promise.<(CopyResponseObject|undefined)>

Move one or multiple mails

Kind: instance method of MailboxJs

ParamTypeDescription
mailboxPathstringMailbox's name from
toMailboxPathstringMailbox's name to
toMoveUidsListList of mails to move

mailboxJs.deleteMails(mailboxPath, toDelete) ⇒ Promise.<(boolean|undefined)>

Delete one or multiple mails

Kind: instance method of MailboxJs

ParamTypeDescription
mailboxPathstringMailbox's name
toDeleteUidsListList of mails to delete

mailboxJs.addMailsFlags(mailboxPath, flags, toAdd) ⇒ Promise.<(boolean|undefined)>

Add flags to one or multiple mails

Kind: instance method of MailboxJs

ParamTypeDescription
mailboxPathstringMailbox's name
flagsArray.<string>Array of flags
toAddUidsListList of mails to add flags

mailboxJs.removeMailsFlags(mailboxPath, flags, toRemove) ⇒ Promise.<(boolean|undefined)>

Remove flags to one or multiple mails

Kind: instance method of MailboxJs

ParamTypeDescription
mailboxPathstringMailbox's name
flagsArray.<string>Array of flags
toRemoveUidsListList of mails to remove flags

mailboxJs.getMail(mailboxPath, uid) ⇒ Promise.<(Mail|undefined)>

Get a mail from uid

Kind: instance method of MailboxJs

ParamTypeDescription
mailboxPathstringMailbox's name
uidnumberUid of mail to get

mailboxJs.getMails(mailboxPath, toFetch) ⇒ Promise.<(Array.<Mail>|undefined)>

Get multiple mails

Kind: instance method of MailboxJs

ParamTypeDescription
mailboxPathstringMailbox's name
toFetchUidsListList of mails's uids to fetch

mailboxJs.getUnseenMails(mailboxPath) ⇒ Promise.<(Array.<Mail>|undefined)>

Get unseen mails

Kind: instance method of MailboxJs

ParamTypeDescription
mailboxPathstringMailbox's name

mailboxJs.getSeenMails(mailboxPath) ⇒ Promise.<(Array.<Mail>|undefined)>

Get seen mails

Kind: instance method of MailboxJs

ParamTypeDescription
mailboxPathstringMailbox's name