@appliedblockchain/ab-email

1.0.0 • Public • Published

Applied Blockchain Email

Description

An email client with template support for emails using HTML. Currently supports Sendgrid (used by default).

Prerequisites

  • Have a Sendgrid account if you're using the sendgrid provider.

Example

const AppliedBlockchainEmail = require('ab-email')

const templates = {
  invite: {
    html: `h1 Hi #{name}
div.container
  p You been invited to join the Applied Blockchain community. Please click here #{link}. `
  },
  otherTemplate: {
    // ...
  }
}

const email = new AppliedBlockchainEmail(templates)

email.invite.send({
    to: 'someone@appliedblockchain.com',
    from: 'invitation@appliedblockchain.com',
    subject: 'You\'ve been invited!',
    html: { 
      name: 'Jane Doe', 
      link: 'your-app.io/invite' 
    }
})

Development

A Mailtrap account is necessary for development.

Make sure linting runs successfully, all tests pass and coverage thresholds are met before committing any changes to the master branch.

Run lint

$ node run lint

Run tests

$ node run test

Check coverage

$ node run coverage

Environment Variables

You can override default configurations by setting these environment variables:

  • AB_EMAIL_PROVIDER: Set Email provider.
  • SENDGRID_API_KEY: Sendgrid api key.

Readme

Keywords

none

Package Sidebar

Install

npm i @appliedblockchain/ab-email

Weekly Downloads

9

Version

1.0.0

License

ISC

Unpacked Size

11 kB

Total Files

21

Last publish

Collaborators

  • ewan-sims-applied-blockchain
  • lanreayobamidele
  • andyharr15
  • aditya.gupta.appliedblockchain
  • geoffreychalk
  • brunoneves-devops
  • samfcmc
  • tiagorvmartins
  • kjack83
  • losceicco
  • ruisereno
  • telmof
  • andremfaria
  • lbltavaresab
  • ztadic91
  • pedrolino
  • alisson-diniz-ab
  • juniorerico
  • diogopalhais
  • gabspeck
  • ab-ci
  • andycampbell92
  • mirek
  • danchmelo
  • seromenho
  • kennypt
  • zeluisping
  • pmcleite-ab
  • filipepedro
  • mnikolaus
  • bertola
  • lpalmeida
  • lslima91