How to use nodemailer-mailgun-transport - 2 common examples

To help you get started, we’ve selected a few nodemailer-mailgun-transport examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github getstalkr / email-sender / src / helpers / sendMessage.js View on Github external
import nodemailer from 'nodemailer';
import mailgun from 'nodemailer-mailgun-transport'

const sender = {
  auth: {
    api_key: process.env.KEY,
    domain: process.env.DOMAIN
  }
}

const dest = {
  username: process.env.EMAIL_DEST_USER
}

const transporter = nodemailer.createTransport(mailgun(sender))

export default function sendMessage (subject, message, user) {

  const email = {
    from: user,
    to: dest.username,
    subject,
    html: message
  };

  return new Promise((resolve, reject) => {

    transporter.sendMail(email, (err, info) => {

      if(err) { return reject(err) }
github iotexproject / iotex-explorer / src / shared / onefx-auth / mailgun.ts View on Github external
constructor(opts: MailgunOpts) {
    this.opts = opts;
    this.transporter = mailer.createTransport(
      mg({
        auth: {
          api_key: opts.apiKey,
          domain: opts.domain
        }
      })
    );
  }

nodemailer-mailgun-transport

A transport module to use with nodemailer to leverage Mailgun's REST API

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis

Popular nodemailer-mailgun-transport functions