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

mailgun-nodemailer-transport

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailgun-nodemailer-transport

Mailgun API V3 and Nodemailer v4+. The plugin is very small, optimized and written in TypeScript

  • 3.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.4K
increased by77.73%
Maintainers
1
Weekly downloads
 
Created
Source

mailgun-nodemailer-transport

Intro

The custom transport plugin that allows to send email using Nodemailer via Mailgun

Why?

Created for the new v3 Mailgun API and Nodemailer v4+. The plugin is very small, optimized and written in TypeScript

Support the project

If you like to use this module please click the star button - it is very motivating.

Quick Start

Install mailgun-nodemailer-transport using npm:

$ npm install mailgun-nodemailer-transport --save

Documentation

Nodemailer common fields are supported and replyTo

Examples

send simple email

  'use strict';
  const nodemailer = require('nodemailer');
  const MailgunTransport = require('mailgun-nodemailer-transport');

  let transporter = nodemailer.createTransport(new MailgunTransport({
    auth: {
      domain: 'your domain name https://app.mailgun.com/app/domains',
      apiKey: '12124124124124-key-test'
    }
  }));

  transporter.sendMail({
    from: 'email@example.com',
    to: 'recipient@test.com',
    replyTo: 'reply-to@example.com',
    subject: 'Mailgun Transport',
    text: 'This is text content'
  }).then((info) => {
    console.log('SUCCESS');
  }).catch((error) => {
    console.log('Something is wrong');
  });

send attachment and add to content

  'use strict';
  const nodemailer = require('nodemailer');
  const MailgunTransport = require('mailgun-nodemailer-transport');

  let transporter = nodemailer.createTransport(new MailgunTransport({
    auth: {
      domain: 'your domain name https://app.mailgun.com/app/domains',
      apiKey: '12124124124124-key-test'
    }
  }));

  transporter.sendMail({
    from: 'email@example.com',
    to: 'recipient@test.com',
    replyTo: 'reply-to@example.com',
    subject: 'Mailgun Transport',
    html: '<!DOCTYPE html><html><body><img src="cid:attachment" alt="attachment"></body></html>',
    attachments: [{
      content: '/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAA...', // base64 content
      cid: 'attachment',
      contentType: 'image/jpeg',
      filename: 'attachment.jpg',
      encoding: 'base64'
    }]
  }).then((info) => {
    console.log('SUCCESS');
  }).catch((error) => {
    console.log('Something is wrong');
  });

License

MIT

Keywords

FAQs

Package last updated on 28 Jul 2023

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