magnet-mailer
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

Magnet wrapper for Nodemailer

Usage

Basic

import magnet from 'magnet-core';
import Config from 'magnet-config';
import Logger from 'magnet-bunyan';
import Mailer from 'magnet-mailer';

let app = await magnet([Config, Logger, Mailer]);

let response = await app.mailer.nodemailer.sendMail({
  from: 'from-kievechua@example.com',
  to: 'to-kievechua@example.com',
  subject: 'Yo',
  text: 'Hola'
})

server/config/mailer.js

import mg from 'nodemailer-mailgun-transport'
import htmlToText from 'nodemailer-html-to-text'

export default {
  plugins: {
    compile: htmlToText()
  },

  transport: {
    host: 'smtp.gmail.com',
    port: 465,
    secure: true, // use SSL
    auth: {
      user: 'user@gmail.com',
      pass: 'pass'
    }
  },

  transport: mg({
    auth: {
      api_key: 'apiKey',
      domain: 'magnet.js.org'
    }
  })
}

Package Sidebar

Install

npm i magnet-mailer

Weekly Downloads

4

Version

3.0.1

License

MIT

Last publish

Collaborators

  • kievechua