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

  • 1.0.8
  • 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

Usage

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

config/mailers.js

const config = {
	//Options here
}

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

module.exports = MailerQ;
Available Options for MailerQ Configuration
  • defaultFrom (Optional): Set the default sender
  • defaultTo (Optional): Set the default recipient (not common)
  • host: Sending host
  • port: Port from which to send email
  • auth (Optional): User and pass for authentication
  • htmlBody (Optional): HTML to send in email message
  • renderer (Optional): Method to render email templates
  • redis (Optional): Redis connection settings (more on this below)

Example:

const config = {
    defaultFrom: "Test Tester test@example.com",
    defaultTo: "recipient@test.com",
    host: "smtp.example.com",
    port: 587,
    auth: {
        user: "your username",
        pass: "your pass"
    },
	htmlBody: "<h1>Hello World!</h1>"
}
Optional Renderers
  • EJS Renderer: Use the EJS templating syntax.
  • Handlebars Renderer: Use the Handlebars templating syntax.
  • Pug Renderer: Use the Pug templating syntax.
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"
})
.deliverNow()
.then(() => {
	console.log("Message sent!");
})
.catch((err) => {
	console.log(err);
});
Available Options for .contents()
  • from (Optional): Email address of sender
  • to (Optional): Email address of recipient
  • subject: Subject of message
  • templateFileName (Optional): Name of file used as template (only use this is you're using a renderer plugin)
  • locals (Optional): Object of local variables to be used in renderer
Redis Connection Settings
  • If you need to connect to Redis in a custom way, you can set an object in the configuration options like so:
const config = {
	redis: {
		port: 1234,
		host: "10.0.5.1",
		auth: "password",
		db: 3 //If provided, select a non-default Redis db,
		options: {
			//See https://github.com/mranney/node_redis#rediscreateclient
		}
	}
}
  • You can also configure Redis using a connection string:
const config = {
	redis: "redis://example.com:1234?redis_option=value&redis_option=value"
}

FAQs

Package last updated on 18 Jun 2017

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