This package has been deprecated

Author message:

this package is no longer maintained and propably broken

peryton

0.0.2 • Public • Published

peryton

A simple API to send emails formatted with various templating libs.

This module also wraps nodemailer, making e-mail sending easy.

Build Status

Templating engines

The following templating engines are supported. The dependencies listed are required in order to run them along with this library.

API

swig

The following example illustrates how to use peryton with swig template engine.

For swig it's also possible to define custom filters:

    var Email = require('peryton'),
        email = Email.create({
            // route to your template file
            template: 'file.html',
            // before you can send any e-mails you need to set up a transport method
            transport: Email.Transport({
                service: 'Gmail', 
            auth: { 
                    username: "username@gmail.com", 
                    password: "yourpassword" 
                }
        }),
            // use swig
            engine: Email.Swig({
                config: {
                    cache: process.env['NODE_ENV'] === 'production' ? 'memory' : false,
                },
                // define custom filters
                filters: { 
                    smurf: function(str){ 
                        return str.replace(/\w+/g,'smurf') 
                    } 
                }
            }),
        });
 
    email.send( to, from, subject, locals, function( err, email ){
        // return callback gets two parameters: err, mail
    });
jade

In the case of jade, you will need to define your mixins:

engine: Email.Jade({
    config: {
        cache: process.env['NODE_ENV'] === 'production' ? 'memory' : false,
    },
    // define custom mixins
    mixins: { 
       smurf: function(str){ 
           return str.replace(/\w+/g,'smurf') 
       } 
    }
})

Install

The source is available for download from GitHub. Alternatively, you can install using Node Package Manager (npm):

npm install peryton --save

/peryton/

    Package Sidebar

    Install

    npm i peryton

    Weekly Downloads

    0

    Version

    0.0.2

    License

    BSD

    Last publish

    Collaborators

    • mvhenten