MailboxJs
MailboxJs
MailboxJS Used to interact with a mailbox by IMAP or/and SMTP
Kind: global class
- MailboxJs
- new MailboxJs(config)
- .run() ⇒
MailboxJs
- .on(event, callback)
- .send(to, subject, text, attachments, from)
- .sendHtml(to, subject, text, html, attachments, from)
- .getMailboxes() ⇒
Map.<string, Mailbox>
- .createMailbox(mailboxPath) ⇒
Promise.<(MailboxCreateResponse|undefined)>
- .deleteMailbox(mailboxPath) ⇒
Promise.<(MailboxDeleteResponse|undefined)>
- .renameMailbox(mailboxPath, newMailboxPath) ⇒
Promise.<(MailboxRenameResponse|undefined)>
- .copyMails(mailboxPath, toMailboxPath, toCopy) ⇒
Promise.<(CopyResponseObject|undefined)>
- .moveMails(mailboxPath, toMailboxPath, toMove) ⇒
Promise.<(CopyResponseObject|undefined)>
- .deleteMails(mailboxPath, toDelete) ⇒
Promise.<(boolean|undefined)>
- .addMailsFlags(mailboxPath, flags, toAdd) ⇒
Promise.<(boolean|undefined)>
- .removeMailsFlags(mailboxPath, flags, toRemove) ⇒
Promise.<(boolean|undefined)>
- .getMail(mailboxPath, uid) ⇒
Promise.<(Mail|undefined)>
- .getMails(mailboxPath, toFetch) ⇒
Promise.<(Array.<Mail>|undefined)>
- .getUnseenMails(mailboxPath) ⇒
Promise.<(Array.<Mail>|undefined)>
- .getSeenMails(mailboxPath) ⇒
Promise.<(Array.<Mail>|undefined)>
new MailboxJs(config)
Contructor of MailboxJS
Param | Type | Description |
---|---|---|
config | MailboxJsConfig | Configuration 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
Param | Type | Description |
---|---|---|
event | 'mail' | 'delete' | Event you want to listen to |
callback | function | Function 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
Param | Type | Description |
---|---|---|
to | string | Receiver identity |
subject | string | Subject of the mail |
text | string | Content text of the mail |
attachments | Array.<Attachment> | Mail attachments |
from | string | Sender identity |
mailboxJs.sendHtml(to, subject, text, html, attachments, from)
Send a html mail
Kind: instance method of MailboxJs
Param | Type | Description |
---|---|---|
to | string | Receiver identity |
subject | string | Subject of the mail |
text | string | Content text of the mail |
html | string | Content html of the mail |
attachments | Array.<Attachment> | Attachment | Mail attachments |
from | string | Sender 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
Param | Type | Description |
---|---|---|
mailboxPath | string | Mailbox's name to create |
mailboxJs.deleteMailbox(mailboxPath) ⇒ Promise.<(MailboxDeleteResponse|undefined)>
Delete a mailbox
Kind: instance method of MailboxJs
Param | Type | Description |
---|---|---|
mailboxPath | string | Mailbox's name to delete |
mailboxJs.renameMailbox(mailboxPath, newMailboxPath) ⇒ Promise.<(MailboxRenameResponse|undefined)>
Rename a mailbox
Kind: instance method of MailboxJs
Param | Type | Description |
---|---|---|
mailboxPath | string | Mailbox's name to rename |
newMailboxPath | string | New mailbox's name |
mailboxJs.copyMails(mailboxPath, toMailboxPath, toCopy) ⇒ Promise.<(CopyResponseObject|undefined)>
Copy one or multiple mails
Kind: instance method of MailboxJs
Param | Type | Description |
---|---|---|
mailboxPath | string | Mailbox's name |
toMailboxPath | string | To mailbox's name |
toCopy | UidsList | List of mails to copy |
mailboxJs.moveMails(mailboxPath, toMailboxPath, toMove) ⇒ Promise.<(CopyResponseObject|undefined)>
Move one or multiple mails
Kind: instance method of MailboxJs
Param | Type | Description |
---|---|---|
mailboxPath | string | Mailbox's name from |
toMailboxPath | string | Mailbox's name to |
toMove | UidsList | List of mails to move |
mailboxJs.deleteMails(mailboxPath, toDelete) ⇒ Promise.<(boolean|undefined)>
Delete one or multiple mails
Kind: instance method of MailboxJs
Param | Type | Description |
---|---|---|
mailboxPath | string | Mailbox's name |
toDelete | UidsList | List of mails to delete |
mailboxJs.addMailsFlags(mailboxPath, flags, toAdd) ⇒ Promise.<(boolean|undefined)>
Add flags to one or multiple mails
Kind: instance method of MailboxJs
Param | Type | Description |
---|---|---|
mailboxPath | string | Mailbox's name |
flags | Array.<string> | Array of flags |
toAdd | UidsList | List 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
Param | Type | Description |
---|---|---|
mailboxPath | string | Mailbox's name |
flags | Array.<string> | Array of flags |
toRemove | UidsList | List of mails to remove flags |
mailboxJs.getMail(mailboxPath, uid) ⇒ Promise.<(Mail|undefined)>
Get a mail from uid
Kind: instance method of MailboxJs
Param | Type | Description |
---|---|---|
mailboxPath | string | Mailbox's name |
uid | number | Uid of mail to get |
mailboxJs.getMails(mailboxPath, toFetch) ⇒ Promise.<(Array.<Mail>|undefined)>
Get multiple mails
Kind: instance method of MailboxJs
Param | Type | Description |
---|---|---|
mailboxPath | string | Mailbox's name |
toFetch | UidsList | List of mails's uids to fetch |
mailboxJs.getUnseenMails(mailboxPath) ⇒ Promise.<(Array.<Mail>|undefined)>
Get unseen mails
Kind: instance method of MailboxJs
Param | Type | Description |
---|---|---|
mailboxPath | string | Mailbox's name |
mailboxJs.getSeenMails(mailboxPath) ⇒ Promise.<(Array.<Mail>|undefined)>
Get seen mails
Kind: instance method of MailboxJs
Param | Type | Description |
---|---|---|
mailboxPath | string | Mailbox's name |