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 = ;const mail = email: "test@example.com" password: "password" domain: "example.com";// orconst mail = domain: 'example.com' b64: `base64 string of 'email:password'` ;
List
List all users on a box
mail;
Add Account
Create a new account
mail;
Remove Account
Remove an account (not archived). Almost indentical to adding a user, but it doesn't require a password.
mail;
List Aliases
List all existing aliases
mail;
Add Alias
Add an alias Parameters: account to forward from, account to forward to.
mail;
Remove Alias
Remove an alias
mail;
Add DNS
Add a DNS record
mail; /* The API returns a successful status even if the DNS record has already been set! */
Remove DNS
Remove a DNS record
mail; /* 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! :)