Socket
Socket
Sign inDemoInstall

periodicjs.core.mailer

Package Overview
Dependencies
253
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    periodicjs.core.mailer

nodemailer transport loader for periodicjs


Version published
Weekly downloads
2
decreased by-93.1%
Maintainers
1
Install size
80.4 MB
Created
Weekly downloads
 

Readme

Source

periodicjs.core.mailer Coverage Status Build Status

Periodic's Code mailer module exports a single function that asynchronously returns a node mailer transport to send transactional emails with.

API Documentation

Installation

$ npm install periodicjs.core.mailer

This is a part of Periodic's core.

Usage

Sending Emails

JavaScript

var CoreMailer = require('periodicjs.core.mailer'),
  sampleemail ={
    to: "user@example.com",
    cc: "service@example.com",
    subject: "sample email test",
    generateTextFromHTML: true,
    html: "<h1>Welcome User</h1><p>email rocks</p>"
  },
  emailtransport;

  //instance methods
  const newCoreMailer = new CoreMailer({ 
    config: { 
      transportConfig: {
        type: 'stub',
        transportoptions: {
          debug: true,
          args: ['-t', '-i']
        },
      },
    },
  });
  newCoreMailer.sendEmail(sampleemail)
  .then(console.log)
  .catch(console.error);
  //static methods
  CoreMailer.sendEmail(sampleemail)
  .then(console.log)
  .catch(console.error);

//example transports
const sendmailTransportExample = {
  "type":"sendmail",
  "transportoptions":{
    "debug":true,
    "args":["-t","-i"]
  }
};
const SMTPTransportExample = {
  "type":"SMTP",
  "transportoptions":{
    "service": "SendGrid",
    "auth": {
      "user": "username",
      "pass": "password"
    }
  }
};
const SESTransportExample = {
  "type":"ses",
  "transportoptions":{
    "accessKeyId": "ACCESSKEYID",
    "secretAccessKey": "SECRETACCESSKEY"
  }
};
//all types:
const transports = {
  ses,
  sendmail: sendmailTransport,
  'smtp-pool': smtpPool,
  sendgrid: sgTransport,
  mailgun: mgTransport,
  stub: stubTransport,
  direct: directTransport,
}

API

//options.emailtemplatefilepath
CoreMailer.getEmailTemplateHTMLString(options); //Promise.resolve(templateString);
//options.transportObject.transportType, options.transportObject.transportOptions
CoreMailer.getTransport(options); //Promise.resolve(nodemailertransport); 
//options.to, options.from, options.html, options.subject, etc
CoreMailer.sendEmail(options); //Promise.resolve(emailstatus);

Development

Make sure you have grunt installed

$ npm install -g grunt-cli

For tests

$ grunt test && grunt coveralls

For generating documentation

$ grunt doc
$ jsdoc2md lib/**/*.js > doc/api.md

Notes

Keywords

FAQs

Last updated on 11 Mar 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc