Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pomo-mailer

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pomo-mailer

Mail Renderer, Mail Queue, Task Manager

  • 0.2.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by33.33%
Maintainers
2
Weekly downloads
 
Created
Source

Pomo Mailer

  • Render multi-language mail with jade template.
  • Mail queue based on MongoDB, send mail by local timezone.
  • Manage cyclical task, resume from original progress when terminated.
  • Built-in some useful templates.
  • Mail agent using HTTP API.
{Mailer, Queue, Agent, Task} = require 'pomo-mailer'

Mailer

mailer = new Mailer
  server:
    service: 'Postmark'
    auth:
      user: 'postmark-api-token'
      pass: 'postmark-api-token'

  from: 'Pomotodo <robot@pomotodo.com>'

mailer.sendMail 'action', 'jysperm@gmail.com',
  title: 'Please confirm your email address'
  link: 'https://pomotodo.com'
  action: 'Confirm'
.then console.log
.catch console.error

Queue

queue = new Queue
  mailer: mailer
  mongodb: 'mongodb://localhost/pomo-mailer-test'

queue.pushMail
  template: 'billing'
  address: 'jysperm@gmail.com'
  locals: generateBilling()
.then console.log
.catch console.error

Agent

agent = new Agent
  queue: queue
  users:
    jysperm: 'pass'

app = express()
app.use bodyParser.json()
app.use agent.express()

Task

task = new Task
  name: 'weekly'
  worker: worker
  groupBy: -> moment().format 'YYYY-W'
  nextGroup: -> moment().startOf('week').add(weeks: 1)

worker = (task) ->
  return Q.Promise (resolve, reject, notify) ->
    db.accounts.find
      _id:
        $gte: task.progress ? null
    .sort
      _id: 1
    .then (accounts) ->
      async.each accounts, ({_id, email, generateWeekly}) ->
        notify _id
        mailer.sendMail 'weekly', email, generateWeekly()
      .then resolve, reject

Built-in templates

  • action
  • alert
  • billing

Some useful templates converted from mailgun/transactional-email-templates.

Common fields:

  • title {String}

  • detail {String}

  • link {String}

  • action {String}

  • copyright {String}

  • unsubscribe {Object}

    • before {String}
    • link {String}
    • action {String}
    • after {String}

alert fields:

  • alert {String}

billing fields:

  • address {Array} of {String}

  • products {Array}

    • name {String}
    • price {String}
  • total {Object}

    • name {String}
    • price {String}

FAQs

Package last updated on 21 Dec 2015

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