mailinabox

2.0.0 • Public • Published

mailinabox

A simple package to communicate with the mailinabox API. The API is installed onto every instance of mailinabox.

mailinabox.email

Installation

npm i mailinabox

Basic Use

Create a new "user" (for authentication). Remember, don't load your credentials from /var/www/html/ or bad things may occur.

const mailinabox = require('mailinabox');
const mail = new mailinabox({ email: "test@example.com", password: "password", domain: "example.com"});
// or
const mail = new mailinabox({ domain: 'example.com', b64: `base64 string of 'email:password'` });

List

List all users on a box

mail.list().then(console.log);

Add Account

Create a new account

mail.addAccount("new@example.com", "password").then(console.log);

Remove Account

Remove an account (not archived). Almost indentical to adding a user, but it doesn't require a password.

mail.removeAccount("new@example.com").then(console.log);

List Aliases

List all existing aliases

mail.listAlias().then(console.log);

Add Alias

Add an alias Parameters: account to forward from, account to forward to.

mail.addAlias('from@example.com', 'forward_to@example.com').then(console.log);

Remove Alias

Remove an alias

mail.removeAlias('from@example.com').then(console.log);

Add DNS

Add a DNS record

mail.addDNS('google.com').then(console.log);
    /*  The API returns a successful status even if 
        the DNS record has already been set!  */

Remove DNS

Remove a DNS record

mail.removeDNS('google.com').then(console.log);
    /*  The API returns a successful status even if 
            the DNS record has already been removed!  */

Tips

Cache results, including members added/listing. It can increase performance of your app since less API calls may be used! :)

Readme

Keywords

Package Sidebar

Install

npm i mailinabox

Weekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

7.38 kB

Total Files

4

Last publish

Collaborators

  • khafra