Socket
Book a DemoInstallSign in
Socket

@pixul/nodemailer-sparkpost

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixul/nodemailer-sparkpost

SparkPost transport for Nodemailer

3.0.3
latest
Source
npmnpm
Version published
Weekly downloads
6
500%
Maintainers
3
Weekly downloads
 
Created
Source

SparkPost transport for Nodemailer

This is a fork of nodemailer-sparkpost-transport.

Travis CI Coverage Status npm version

Lead Maintainer: Daniel Cole

Usage

Install

npm install @pixul/nodemailer-sparkpost

Create a Nodemailer transport object

const Nodemailer = require('nodemailer');
const SparkPostTransport = require('@pixul/nodemailer-sparkpos');
const Transporter = Nodemailer.createTransport(SparkPostTransport(options));

where:

  • options defines connection default transmission properties
    • sparkPostApiKey - SparkPost API Key. If not provided, it will use the SPARKPOST_API_KEY env var.
    • endpoint - The endpoint to use for the SparkPost API requests. If you have a SparkPost EU account, set this to https://api.eu.sparkpost.com (optional)
    • campaign_id - Name of the campaign (optional)
    • metadata - Transmission level metadata containing key/value pairs (optional)
    • options - JSON object in which transmission options are defined (optional)
    • substitution_data - Key/value pairs that are provided to the substitution engine (optional)

For more information, see the SparkPost API Documentation for Transmissions

Send a message

transport.sendMail({
  from: 'me@here.com',
  to: 'you@there.com',
  subject: 'Very important stuff',
  text: 'Plain text',
  html: 'Rich taggery'
}, function(err, info) {

  if (err) {
    console.log('Error: ' + err);
  } else {
    console.log('Success: ' + info);
  }
});

Read more about Nodemailer's sendMail() method here.

Additional Options

The SparkPost Nodemailer transport also supports a few SparkPost-specific sendMail() options in both the transport constructor and the 'sendMail()` method.

Note: sendMail() options override their constructor counterparts:

  • options
    • campaign_id - Overrides for constructor option
    • metadata - Override for constructor option
    • options - Override for constructor option
    • substitution_data - Override for constructor option

Keywords

nodemailer

FAQs

Package last updated on 08 Nov 2019

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.