use foundation email template builder programmatically
Last updated 3 years ago by kairos666 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install inky-email-render-to-string 
SYNC missed versions from official npm registry.


use foundation inky v2 email template builder programmatically. Provide data and receive a string back.

alt tag


npm install inky-email-render-to-string


instanciate the class with the path to email templates folder. Then you can use the produceMail method with parameters to output a promise with the email as a string. You can render several email templates as long as they share the same default layout.

const InkyMailOutput = require('inky-email-render-to-string');

// create instance with relative root path to template assets folder
let instance = new InkyMailOutput('email-template');

// provide mail (template, conf, data) --> return processed email as promise
let templateName = 'basic';

// respective folders (see Inky/Panini Docs) + mail subject
let emailConfig = {
    root: 'pages',
    layouts: 'layouts',
    partials: 'partials',
    helpers: 'helpers',
    css: 'css/app.css',
    subject: 'My Basic Email Template Subject'

// all data to populate the email template
let emailData = {
    title: 'Hi, Susan Calvin',
    content: {
        lead: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magni, iste, amet consequatur a veniam.',
        body: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut optio nulla et, fugiat. Maiores accusantium nostrum asperiores provident, quam modi ex inventore dolores id aspernatur architecto odio minima perferendis, explicabo. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima quos quasi itaque beatae natus fugit provident delectus, magnam laudantium odio corrupti sit quam. Optio aut ut repudiandae velit distinctio asperiores?',
        callout: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reprehenderit repellendus natus, sint ea optio dignissimos asperiores inventore a molestiae dolorum placeat repellat excepturi mollitia ducimus unde doloremque ad, alias eos!'

// render email and rceive promise based email string
instance.produceMail(templateName, emailConfig, emailData).then(
    function(resp) { 
        console.log('successful email render', resp); 
    function(error) { console.log(error); }

Note: the email-template folder is provided as a sample based on Foundation email template. You can delete it and provide your own. Remember to modify the config accordingly.



  • no need to pass data folder property in emailConfig. It is setup automatically.
  • fixed root path calculation when used as dependency package

Current Tags

  • 0.0.2                                ...           latest (3 years ago)

2 Versions

  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (8)
Dev Dependencies (0)
Dependents (0)

Copyright 2014 - 2016 © |