mailinabox
v2.0.0
Published
Use the mailinabox api
Readme

A simple package to communicate with the mailinabox API. The API is installed onto every instance of mailinabox.
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: "[email protected]", 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("[email protected]", "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("[email protected]").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('[email protected]', '[email protected]').then(console.log);Remove Alias
Remove an alias
mail.removeAlias('[email protected]').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! :)
