New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nodemailer-mandrill-transport

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodemailer-mandrill-transport

Mandrill transport for Nodemailer

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.1K
increased by8.69%
Maintainers
3
Weekly downloads
 
Created
Source

nodemailer-mandrill-transport

A Mandrill transport for Nodemailer.

Build Status NPM version

Example

'use strict';

var nodemailer = require('nodemailer');

var mandrillTransport = require('nodemailer-mandrill-transport');

var transport = nodemailer.createTransport(mandrillTransport({
  auth: {
    apiKey: 'key'
  }
}));

transport.sendMail({
  from: 'sender@example.com',
  to: 'user@example.com',
  subject: 'Hello',
  html: '<p>How are you?</p>'
}, function(err, info) {
  if (err) {
    console.error(err);
  } else {
    console.log(info);
  }
});

Using Mandrill API options

It is possible to use any Messages Send Mandrill API option by passing it into the mandrillOptions option. These will be deeply merged over the API call this transport builds for you. For example, this transport enables the async option by default. To disable this,

transport.sendMail({
  mandrillOptions: {
    async: false
  }
}, /* ... */);

Sending Images to Mandrill

To send images as attachments:

transport.sendMail({
  mandrillOptions: {
    images: [
      'type': 'image/png',
      'name': 'IMAGECID',
      'content': 'ZXhhbXBsZSBmaWxl',
    ],
  }
}, /* ... */);

name: image cid:

Reference your attached image in your HTML:

<img src="IMAGECID">

Make sure to use unique cids for your images!

content: a base64 representation of your image.

var fs = require('fs');
var imgBuff = fs.readFileSync('path/to/file');

imgBuff.toString('base64');

Using Mandrill Templates

To send email using templates stored on Mandrill:

transport.sendMail({
  mandrillOptions: {
    template_name: 'MANDRILL_TEMPLATE_SLUG'
  }
}, /* ... */);

Keywords

FAQs

Package last updated on 12 Aug 2016

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