New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mailer-q

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailer-q

A redis-backed mailer queue system

  • 2.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

MailerQ

MailerQ is a Redis-backed mailer queue system.

Installation

npm install mailer-q --save

Usage

  • It is easiest to have MailerQ's configuration in another module:

config/mailers.js

const MailerQ = require("mailer-q")();

const options = {
  //Options here
};

module.exports = MailerQ.config(options);
Available Options for MailerQ Configuration
  • nodemailer: Configuration object for Nodemailer. An example is shown below but all options can be found in the Nodemailer documentation here: https://nodemailer.com/smtp/.
  • defaultFrom (Optional): Set the default sender
  • defaultTo (Optional): Set the default recipient (not common)
  • renderer (Optional): Method to render email templates
  • sendAttempts (Optional): Number of times MailerQ will attempt to send your mail. Defaults to 3.
  • redis (Optional): Configuration options to configure Redis. These configuration options come from ioredis and you can find all options in their documentation here: https://github.com/luin/ioredis/blob/master/API.md.

Example:

const config = {
  nodemailer: {
    host: "smtp.example.com",
    port: 587,
    auth: {
      user: "your username",
      pass: "your pass"
    }
  },
  defaultFrom: "Test Tester test@example.com",
  defaultTo: "recipient@test.com",
  sendAttempts: 5
};
Optional Renderers
Sending Mail
  • The module has two methods - deliverNow and deliverLater.
  • deliverNow will attempt to send the email message immediately, vs deliverLater will use Redis to queue this action up for a later time.
  • deliverNow and deliverLater must be chained with contents, which sets up the content to be sent.

Example:

const MailerQ = require("./config/mailers");

MailerQ.contents({
  from: "Test Sender sender@test.com",
  to: "recipient@example.com",
  subject: "Test message",
  htmlBody: "<h1>HTML message here!</h1>"
})
  .deliverNow()
  .then(() => {
    console.log("Message sent!");
  })
  .catch((err) => {
    console.log(err);
  });
Available Options for .contents()
  • subject: Subject of message
  • from (Optional): Email address of sender. Optional only if not using defaultFrom in the initial configuration.
  • to (Optional): Email address of recipient. Optional only if not using defaultTo in the initial configuration.
  • templateFileName (Optional): Name of file used as template (only use this if you're using a renderer plugin)
  • htmlBody (Optional): HTML to send in email message
  • locals (Optional): Object of local variables to be used in renderer (only use this if you're using a renderer plugin)
  • attachments (Optional): Array of attachment objects as specified by Nodemailer: https://nodemailer.com/message/attachments/.

FAQs

Package last updated on 25 May 2021

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