Node TransacEmail

Transactional Email & Templated Email for NodeJS done right

    Clear Separation of Concerns

    Supports any Template Engine (e.g. Underscore Templates)

    • Mailing.compile(mailDir, {templateEngine: engine});

    Supports any Mail Provider (e.g Mandrill)

    • Mailing.compile(mailDir, {mailProvider: require('transacemail-mandrill')('apikey')});

    Supports any number of CSS files for each email. CSS is automatically inlined for free thanks to Juice

    Supports any file extension

    • Mailing.Mail.DEFAULT_HTML_EXT = ".html";
    • Mailing.Mail.DEFAULT_TEXT_EXT = ".text";
    • Mailing.Mail.DEFAULT_META_EXT = ".meta.js";

See the working example code . We accept pull-requests!

DEFAULT_META_EXT

property
Mail.DEFAULT_META_EXT

Meta file extension

Mail.DEFAULT_META_EXT = '.meta.js';

DEFAULT_HTML_EXT

property
Mail.DEFAULT_HTML_EXT

HTML mail format extension

Mail.DEFAULT_HTML_EXT = '.html';

DEFAULT_TEXT_EXT

property
Mail.DEFAULT_TEXT_EXT

TEXT mail format extension

Mail.DEFAULT_TEXT_EXT = '.txt';

Factory

method
Mail.Factory() -> Mail

Option name Type Description
templateEngine Object Template Engine that will be used to render the mail
metaPath String Path to the mail meta file

Mail Factory

Mail.Factory = function(templateEngine, metaPath){
  return new Mail(templateEngine, metaPath)
        ._readMeta()
        ._readHTML()
        ._mergeCss()
        ._readText();
};