eldoy / wriggler

Send emails with the Mailgun API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrigger

Send messages with the Mailgun API.

Install

npm i wriggler

Setup

Add your default credentials to mail.json in your app's root folder:

{
  "apikey": "",
  "domain": "",
  "from": "",
  "sandbox": {
    "domain": "",
    "from": ""
  }
}

Usage

var wriggler = require('wriggler')

// Default config
var config = {
  apikey: process.env.MAILGUN_API_KEY,
  domain: process.env.MAILGUN_DOMAIN,
  from: 'test@example.com',
  sandbox: {}
}

var client = wriggler(config)

// Send message
var result = await client.send({
  from: 'Excited User <test@example.com>',
  to: ['vidar@eldoy.com'],
  subject: 'Hello',
  text: 'Testing mailer',
  html: '<h1>Testing mailer</h1>'
})

// Get message events
var events = await client.get(result.id)

About

Send emails with the Mailgun API


Languages

Language:JavaScript 100.0%