Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ghost-email-service

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ghost-email-service

nodejs client to interact with the sendgrid and mailchimp apis

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
3
Weekly downloads
 
Created
Source

Ghost Email Service

Installation

npm install ghost-email-service --save

Overview

Config (default listed below)

Provide sendgrid secret key + template names and the associated ID's

Sendgrid Config
{
  "email": {
    "processor": "sendgrid",
    "sendgrid": {
      "secretKey": "[sendgrid secret key]",
      "templates": {
        "templateName": "[templateId]"
      },
      "sandboxMode": true,
      "defaults": {
        "fromEmail": "noreply@yourwebsite.com",
        "fromName": "Pablo Escobar",
        "replyTo": "contact@yourwebsite.com"
      }
    }
  }
}
MailChimp Config
{
  "email": {
    "processor": "mailchimp",
    "mailchimp": {
      "secretKey": "[mailchimp api key]",
      "mandrill": "[mandrill api key]"
      }
    },
    "defaults": {
      "fromEmail": "noreply@yourwebsite.com",
      "fromName": "Justin Tucker",
      "replyTo": "contact@yourwebsite.com"
    }
}

SendGrid Send obj config(default listed below)

{
    "fromEmail": "noreply@domain.com",
    "fromName": "The Ghost Team",
    "toEmail": "noreply@domain.com",
    "toName": "Test User",
    "subject": "Test Email",
    "substitutions": {
      "url": "http://test.com",
      "name": "Test User"
    }
}

MailChimp Send obj config(default listed below)

{
    "fromEmail": "noreply@domain.com",
    "fromName": "The Ghost Team",
    "toEmail": "noreply@domain.com",
    "toName": "Test User",
    "replyTo": "noreply@domain.com",
    "subject": "Test Email",
    "globalMergeVars": {
      "url": "http://test.com",
      "name": "Test User"
    }
}

Models

Sendgrid

The module will attempt to load the mail send services provided in the config object assuming a valid secret key and template id's, along with the sandbox setting. All templates will be available via the send(templateName, obj) method.

MailChimp

The module will attempt to load the mail send services provided in the config object assuming a valid secret key and mandrill key. All templates will be available via the send(templateName, obj) method.

See examples below.

Follow the steps below to get the module up and running.

1. Require

const GhostEmail = require('ghost-email-service');

2. Instantiate

const EmailService = new GhostEmail(config)
// See config above

3. Send Email

Sendgrid

The template name should correspond to a template id within the config object

MailChimp

The template name should correspond to a template found within your mailchimp templates

EmailService.send('templateName',obj)
.then(result => { ... })
.catch(err => { ... });
// See obj above

Keywords

FAQs

Package last updated on 20 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc