hulk-mailer

1.0.6 • Public • Published

hulk-mailer

Installation

$ npm i --save hulk-mailer

Why Hulk Mailer?

Hulk Mailer minimizes the email delivery failures by allowing one to configure multiple Email Service Providers(ESPs). It manages all the email delivery by switching between ESPs depending on their availability and behaviour.

Which ESPs are supported?

Currently four providers are supported: Mailgun, Mandrill, Sendgrid, SES.

Configuration

Configure Email Service Providers.

const config = [
  {
    name: "ironman",
    provider: "mailgun",
    apiKey: "key-imagined",
    domain: "sandboxed.domain.mailgun.org"
  },
  {
    name: "thor",
    provider: "mandrill",
    apiKey: "sandboxedkey"
  },
  {
    name: "hawkeye",
    provider: "sendgrid",
    username: "sandboxed",
    password: "sandboxedkey"
  },
  {
    name: "captainamerica",
    provider: "ses",
    accessKeyId: "sandboxedkey",
    secretAccessKey: "sandboxedAccesskey",
    region: "us-east-1"
  }
]

You can configure multiple accounts of same provider.

const config = [
  {
    name: "ironman",
    provider: "mandrill",
    apiKey: "sandboxedkey",
  },
  {
    name: "hawkeye",
    provider: "mandrill",
    apiKey: "sandboxedkey2"
  }
]

Initialize your config.

// ES5
var HulkMailer = require("hulk-mailer");
HulkMailer.init(config);

// ES6
import HulkMailer from "hulk-mailer";
HulkMailer.init(config);

Add a new Provider on the fly.

HulkMailer.addNewProvider({
  name: "loki",
  provider: "mandrill",
  apiKey: "sandboxedkey",
});

Remove a Provider if not required anymore.

HulkMailer.removeProvider("loki");

Create and send your Email

const email = new HulkMailer.Email({
  "from": "anthonyj7458@gmail.com",
  "to": "anthonyj7458@gmail.com",
  "subject": "Hello Joseph Anthony",
  "text": "Congratulations Joseph Anthony, you just sent an email!"
});
HulkMailer.send(email);
// or
HulkMailer.sendByProvider("thor", email);

See our own Implementation

Want to contribute

Fork us on github.

Dependencies (6)

Dev Dependencies (4)

Package Sidebar

Install

npm i hulk-mailer

Weekly Downloads

7

Version

1.0.6

License

ISC

Last publish

Collaborators

  • anthonyj