2.0.0 • Published 5 years ago

mailinabox v2.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

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! :)

2.0.0

5 years ago

1.5.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago