🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

awesome-content-sender

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awesome-content-sender

Awesome module which send content using cached senders. It comes with a sender which applies a content to an email template and then sends it by a mailer

latest
npmnpm
Version
0.0.1
Version published
Weekly downloads
1
-85.71%
Maintainers
1
Weekly downloads
 
Created
Source

Awesome Content Sender

This module provide a generic AwesomeModule which sends any contents using a sender. It comes with a precoded email-sender. This sender merges a content into a template then send it using the mailer. This mailer is a mandatory dependency and can be found here:

  • om-mailer

Exposed api

  • registerSender(type, sender)

Store a new sender of type type. A minimal sender is as such:

module.exports = {
  send: function(from, to, content, options) {
    var deferred = require('q').defer();
    
    // ...
    // do whatever you want with from, to, content and options.
    // ...
    
    deferred.resolve();
    return deferred.promise;
  }
}
  • send(from, to, content, options, type)

Send the content using the sender stored of type type. It only delegates to sender.send method.

Dependencies

  • linagora.io.mailer: mandatory, it is used in the email-sender.
  • logger: optional, it should at list exposed logger.info and logger.error, otherwise by default it is console.log.
  • config: optional, it should at list exposed config.email.templateDir, otherwise by default it is ./templates.

The email-sender

This sender can be used with:

send(from, to, content, options, **'email'**)
  • from: It is a tuple { objectype: {String}, id: {String} }

  • to: It is a tuple { objectype: {String}, id: {String} }

  • content: Any kind of object

  • options: expected object is

    { template: {String}, mandatory, message: {Object} }

By default templateDir is ./templates. So you must have this directory at the root of your project as such:

| templates                  // templateDir
| -- invitation              // options.template
     | -- style.less
     | -- html.jade
| --  digest                 // options.template
     | --  style.less
     | --  html.jade
| -- ...

Keywords

awesomemodule

FAQs

Package last updated on 24 Sep 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