Skip to content

zrrrzzt/seneca-sendgrid-mail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status js-standard-style Greenkeeper badge

seneca-sendgrid-mail

Seneca SendGrid email plugin.

This is a module for the Seneca microservices toolkit. It's a plugin extension for seneca-mail to enable sending emails via SendGrid.

Visit the seneca-mail page for full usage documention.

Requires Node.js >= 8

Installation

$ npm i seneca
$ npm i seneca-mail
$ npm i seneca-sendgrid-mail

Usage

'use strict'

const seneca = require('seneca')()
const mail = require('seneca-mail')
const sendgridMail = require('seneca-sendgrid-mail')
const sendgridOptions = {
  key: 'YOUR_SENDGRID_API_KEY',
  tag: 'seneca-sendgrid-mail'
}
const email = {
  role: 'mail',
  cmd: 'send',
  text: 'Hi There!',
  to: 'alice@example.com',
  from: 'bob@example.com',
  subject: 'Greetings!'
}

seneca.use(mail)
seneca.use(sendgridMail, sendgridOptions)

seneca.ready(error => {
  if (error) {
    return console.log(error)
  }
  seneca.act(email, (err, response) => {
    if (err) {
      return console.error(err)
    }
    console.log(response)
  })
})

Thx

License

MIT

Robohash image of seneca-sendgrid-mail

About

Seneca sendgrid email plugin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •