npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ms-mailer

v10.7.0

Published

microservice mailer, incorporates nodemailer functionality with a number of useful plugins over smtp pool transport and amqp messageing layer

Downloads

176

Readme

Mailer Microservice

Sets up a rabbitmq consumer with QoS, and distributes incoming messages based on passed options

npm version Build Status semantic-release Commitizen friendly codecov.io

Installation

npm i ms-mailer -S

Compatible with node >= 7.6.x

Usage

const Promise = require('bluebird');
const Mailer = require('ms-mailer');
const AMQP = require('@microfleet/transport-amqp');

const mailer = new Mailer({
  debug: Boolean,
  predefinedLimits: {
    maxConnections: Number,
    maxMessages: Number,
  },
  amqp: {
    // @microfleet/transport-amqp options
  },
  htmlToText: {
    // https://www.npmjs.com/package/html-to-text
  },
  accounts: {
    test: {
      // nodemailer smtp transport configuration
      service: 'yahoo',
      auth: {
        user: '[email protected]',
        pass: '123'
      }
    }
  }
});

// returns promise, which resolves when listeners are established
const mailerReady = mailer.connect();

Promise.props({ mailer: mailerReady, amqp: AMQP.connect() })
.then(function sendMessage(props) {
  const { amqp } = props;
  return amqp.publishAndWait('mailer.predefined', {
    account: 'test',
    email: {
      // nodemailer mail options
      // make sure not to pass streams or paths, as they can't be transferred through the wire
      // as the processing will be held on the other machine
      // in case you want to use some other services like S3, then an expansion can be coded for this module
    }
  });
})
.then(function sendMessageReponse(response) {
  // nodemailer smtp transport response
});

Configuration options

  1. debug - boolean, whether to print log messages or not
  2. prefix - which route prefix to bind to, defaults to mailer
  3. postfixAdhoc - which suffix to use for adhoc messaging
  4. postfixPredefined - which suffix to use for predefined accounts messaging
  5. predefinedLimits - which opts to pass to smtp transport constructor for predefined accounts, consult nodemailer-smtp-transport
  6. amqp - options that are passed to ms-amqp-transport
  7. htmlToText - html to text conversion options for nodemailer
  8. accounts - predefined accounts that are initialized at service startup, format is the same as in the nodemailer smtp transport

Messaging format

  1. Adhoc messaging mailer.adhoc:
{
  "account": String,
  "email": {
    // nodemailer email payload
  }
}
  1. Predefined messaging mailer.predefined:
{
  "account": {
    // nodemailer smtp transport format
  },
  "email": {
    // nodemailer email payload
  }
}

Roadmap

  1. test dkim signing
  2. test different types of messages being sent
  3. test more error cases
  4. add QoS handling on demand