@appliedblockchain/ab-email
v1.0.0
Published
Agnostic email service with a Pugntemplate engine
Downloads
5
Maintainers
Keywords
Readme
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: '[email protected]',
from: '[email protected]',
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.