Git Product home page Git Product logo

forwardemail / email-templates Goto Github PK

View Code? Open in Web Editor NEW
3.6K 67.0 339.0 2.38 MB

Create, preview (browser/iOS Simulator), and send custom email templates for Node.js. Made for @forwardemail, @ladjs, @cabinjs, @spamscanner, and @breejs.

Home Page: https://forwardemail.net/docs/send-emails-with-node-js-javascript

License: MIT License

JavaScript 95.38% HTML 4.09% Shell 0.53%
nodejs email templates template-engine juice pug ejs custom node inline

email-templates's People

Contributors

ddolcimascolo avatar doublesharp avatar dtxe avatar javalavamt avatar luisfilipept avatar maabiddevra avatar mrlannigan avatar niftylettuce avatar peterpetre avatar pke avatar pylebecq avatar shaunwarman avatar sibiraj-s avatar simonepri avatar tanansatpal avatar titanism avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

email-templates's Issues

juice dependancy issue while installing?

npm install --save email-templates
npm http GET https://registry.npmjs.org/email-templates
npm http 304 https://registry.npmjs.org/email-templates
npm http GET https://github.com/niftylettuce/juice/tarball/master
npm http GET https://registry.npmjs.org/underscore/1.3.3
npm http GET https://registry.npmjs.org/ejs/0.8.3
npm http GET https://registry.npmjs.org/async/0.1.22
npm http 304 https://registry.npmjs.org/async/0.1.22
npm http 304 https://registry.npmjs.org/underscore/1.3.3
npm http 304 https://registry.npmjs.org/ejs/0.8.3
npm http 200 https://github.com/niftylettuce/juice/tarball/master
npm http GET https://registry.npmjs.org/mootools-slick-parser/1.3.2
npm http GET https://registry.npmjs.org/cssom/0.2.5
npm http GET https://registry.npmjs.org/jsdom/0.2.14
npm http 304 https://registry.npmjs.org/cssom/0.2.5
npm http 404 https://registry.npmjs.org/mootools-slick-parser/1.3.2
npm http 304 https://registry.npmjs.org/jsdom/0.2.14
npm ERR! 404 'mootools-slick-parser' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, or http url, or git url.

npm ERR! System Darwin 12.2.0
npm ERR! command "/usr/local/Cellar/node/0.8.19/bin/node" "/usr/local/bin/npm" "install" "--save" "email-templates"
npm ERR! cwd /Users/cory/Projects/nodejs/Titan/aladdinsupplyco
npm ERR! node -v v0.8.19
npm ERR! npm -v 1.2.10
npm ERR! code E404
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/cory/Projects/nodejs/Titan/aladdinsupplyco/npm-debug.log
npm ERR! not ok code 0

FATAL ERROR: JS Allocation failed - process out of memory exited with code 5

My script is failing when attempting to load the template, with the following error:

FATAL ERROR: JS Allocation failed - process out of memory exited with code 5

The code that I'm calling looks like this:

emailTemplates(templatesDir, function(err, template) {
    winston.info("Setting up templates.", templatesDir);
    if(err) {
        winston.error(err);
    }else{
        var today = new Date().getDay();
        winston.info("Found that today is ", aDays[today]);

        template("notify", {
            reports: [{
                item: "merged",
                desc: "Blah blah"
            },{
                item: "searched",
                desc: "Blah blah"
            }],
            vars: Operators.BBT.mail,
            day: aDays[today],
            fusionAPIRan: canRunFAPI
        }, function(err, html, text) {
            if(err) {
                winston.error(err);
            }else{
                winston.info("Attempting to send an email!");
                smtpTransport.sendMail({
                    from: "Webmaster <[email protected]>",
                    to: "[email protected]",
                    subject: "Worker - Notification Email",
                    html: html
                }, function(error, response){
                    if(error){
                        winston.error(error);
                        cb(false);
                    }else{ 
                        winston.info("Message sent: " + response.message + ", message id: " + response.messageId);
                        cb(true);
                    }
                });
            }
        });
    }
});

It gets as far as Found that today is xxx and the winston.error inside doesn't get called. What's causing that? A dodgy template perhaps?

Error when trying to install on Windows

This is the results I get when I try to install this module using npm install:

PS C:\Users\UserName\Programming\ProjectName> npm install email-templates
npm http GET https://registry.npmjs.org/email-templates
npm http 200 https://registry.npmjs.org/email-templates
npm http GET https://registry.npmjs.org/email-templates/-/email-templates-0.0.1.tgz
npm http 200 https://registry.npmjs.org/email-templates/-/email-templates-0.0.1.tgz
npm http GET https://registry.npmjs.org/ejs/0.7.1
npm http GET https://github.com/niftylettuce/juice/tarball/master
npm http GET https://registry.npmjs.org/async/0.1.22
npm http 200 https://registry.npmjs.org/ejs/0.7.1
npm http GET https://registry.npmjs.org/ejs/-/ejs-0.7.1.tgz
npm http 200 https://registry.npmjs.org/async/0.1.22
npm http GET https://registry.npmjs.org/async/-/async-0.1.22.tgz
npm http 200 https://github.com/niftylettuce/juice/tarball/master
npm http 200 https://registry.npmjs.org/ejs/-/ejs-0.7.1.tgz
npm http 200 https://registry.npmjs.org/async/-/async-0.1.22.tgz
npm http GET https://registry.npmjs.org/jsdom/0.2.14
npm http GET https://registry.npmjs.org/mootools-slick-parser/1.3.2
npm http GET https://registry.npmjs.org/cssom/0.2.3
npm http 200 https://registry.npmjs.org/cssom/0.2.3
npm http GET https://registry.npmjs.org/cssom/-/cssom-0.2.3.tgz
npm http 200 https://registry.npmjs.org/jsdom/0.2.14
npm http GET https://registry.npmjs.org/jsdom/-/jsdom-0.2.14.tgz
npm http 200 https://registry.npmjs.org/mootools-slick-parser/1.3.2
npm http GET https://registry.npmjs.org/mootools-slick-parser/-/mootools-slick-parser-1.3.2.tgz
npm http 200 https://registry.npmjs.org/cssom/-/cssom-0.2.3.tgz
npm http 200 https://registry.npmjs.org/jsdom/-/jsdom-0.2.14.tgz
npm http 200 https://registry.npmjs.org/mootools-slick-parser/-/mootools-slick-parser-1.3.2.tgz
npm http GET https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/htmlparser
npm http GET https://registry.npmjs.org/request
npm http 200 https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/contextify/-/contextify-0.1.3.tgz
npm http 200 https://registry.npmjs.org/htmlparser
npm http GET https://registry.npmjs.org/htmlparser/-/htmlparser-1.7.6.tgz
npm http 200 https://registry.npmjs.org/contextify/-/contextify-0.1.3.tgz
npm http 200 https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/request/-/request-2.10.0.tgz
npm http 200 https://registry.npmjs.org/htmlparser/-/htmlparser-1.7.6.tgz
npm http 200 https://registry.npmjs.org/request/-/request-2.10.0.tgz
npm WARN [email protected] package.json: bugs['web'] should probably be bugs['url']

> [email protected] preinstall C:\Users\UserName\Programming\ProjectName\node_modules\email-templates\node_modules\juice\node
_modules\jsdom\node_modules\contextify
> node-waf clean || (exit 0); node-waf configure build

node-waf was unexpected at this time.
npm ERR! error installing [email protected]
npm ERR! error installing [email protected]
npm ERR! error rolling back [email protected] Error: UNKNOWN, unknown error 'C:\Users\UserName\Programming\ProjectName\node_modul
es\email-templates\node_modules\juice\node_modules\jsdom\node_modules\___htmlparser.npm\package\pulls\node-htmlparser\te
sts'
npm ERR! error installing [email protected]

npm ERR! Error: ENOENT, no such file or directory 'C:\Users\UserName\Programming\ProjectName\node_modules\email-templates\no
de_modules\juice\node_modules\jsdom\node_modules\___htmlparser.npm\package\pulls\node-htmlparser\tests\20-rss.js'
npm ERR! You may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>
npm ERR!
npm ERR! System Windows_NT 6.0.6002
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\
\npm-cli.js" "install" "email-templates"
npm ERR! cwd C:\Users\UserName\Programming\ProjectName
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! path C:\Users\UserName\Programming\ProjectName\node_modules\email-templates\node_modules\juice\node_modules\jsdom\n
ode_modules\___htmlparser.npm\package\pulls\node-htmlparser\tests\20-rss.js
npm ERR! fstream_path C:\Users\UserName\Programming\ProjectName\node_modules\email-templates\node_modules\juice\node_modules
\jsdom\node_modules\___htmlparser.npm\package\pulls\node-htmlparser\tests\20-rss.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! message ENOENT, no such file or directory 'C:\Users\UserName\Programming\ProjectName\node_modules\email-templates\n
ode_modules\juice\node_modules\jsdom\node_modules\___htmlparser.npm\package\pulls\node-htmlparser\tests\20-rss.js'
npm ERR! errno {}
npm ERR! fstream_stack Object.oncomplete (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\fstream\lib\writer
.js:204:26)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\UserName\Programming\ProjectName\npm-debug.log
npm not ok

I'm running Windows Vista. Why is it having trouble installing it's dependencies? Does this module work with Windows?

API suggestions

The current API works as follows: 1. Require in the module 2. Invoke the exported function 3. Use the templates argument from within the callback of the exported function call to render email templates. This API also expects templates to be directories with three files, html.ejs, text.ejs and style.css. There are few disadvantages to this approach that I can see; you can't set options (yet) for all your template rendering (EJS open/closing tags), and you can't specify a single CSS file to be used for all of the renders.

May I suggest an API more similar to express? 1. Require in the module 2. Configure the module's settings (set ejs settings, stylesheet settings, etc.) 3. call the exported object's render method (emailTemplates.render) to render the EJS files. You can either render a EJS file or a directory where html.ejs is expected and text.ejs is optional. In either case where the text.ejs file is absent or you specify a .ejs file instead of a directory, the text.ejs version is dynamically generated.

Let me know what you think of this suggestion; if it's plausible with how the module currently works or if it's flexible enough to solve all the problems that need to be solved for this module.

Ability to get a list of substitutions from a template

In the interest of making a nice preview tool to preview templates and send test emails, you need to allow the user to enter different things as values in the template.

Currently I have a regex which searches an ejs template for substitutions, but this breaks for includes, and ideally the template engine could list the substitutions for me, after doing all the include/extend stuff.

ability to "extend" a layout

There is a feature in some templating languages called "layout" or "blocks" which lets you do something like this:

blaho doaeudao d
utoaeduoesud soo 
ouoddo
{% block "block_name" %}
(this content is overridable)
{% end block %}
dbosoahueohunoeua
oaeuntdaoesudaoseuhaoeu
oeu
o

Then I could make a new template with something like this:

{% extends "layout_name" %}

{% block "block_name" %}
(I am overriding the content of the other block)
and I even have access to {{ block.super }}
{% end block %}

node-email-templates lacks this feature.

in the first example where is the users object defined?

Specifically in this code:

  template('pasta-dinner', true, function(err, batch) {
    for(var user in users) {
      var render = new Render(users[user]);
      render.batch(batch);
    }
  });

users is not defined outside of the closure and it isn't passed in. I don't see how it could be anything other than undefined. I assume you're using the users object as defined in the next example but the first example doesn't clarify that. It makes the first example really confusing -- why would you for over a list and then get the item back out of the list instead of just passing in the user item?

add support for style.less

It would be nice to have support for style.less that would compile the style.css for me.

I'm using express now w/ less. I'm not exactly sure how they do it, but I never touch the .css file, only the .less file.

Handlebars Helpers

I like to implement handle helpers on my template but a little unsure how I would do this. Is it possible?

npm install email-templates fails in empty directory.

Node-gyp ain't happy.

michael@mc-desktop ~/scm
โ˜€  mkdir temp

michael@mc-desktop ~/scm
โ˜€  cd temp 

michael@mc-desktop ~/scm/temp
โ˜€  npm install email-templates
npm http GET https://registry.npmjs.org/email-templates
npm http 304 https://registry.npmjs.org/email-templates
npm WARN engine [email protected]: wanted: {"node":"0.8.x | 0.10.x"} (current: {"node":"v0.10.28","npm":"1.4.9"})
npm http GET https://registry.npmjs.org/ejs
npm http GET https://registry.npmjs.org/juice
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/swig
npm http GET https://registry.npmjs.org/combined-stream
npm http GET https://registry.npmjs.org/jade
npm http GET https://registry.npmjs.org/handlebars
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/stylus
npm http GET https://registry.npmjs.org/styl
npm http GET https://registry.npmjs.org/node-sass
npm http GET https://registry.npmjs.org/less
npm http 304 https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/juice
npm http 304 https://registry.npmjs.org/ejs
npm http 304 https://registry.npmjs.org/combined-stream
npm http 304 https://registry.npmjs.org/swig
npm http 304 https://registry.npmjs.org/jade
npm http 304 https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/handlebars
npm http 304 https://registry.npmjs.org/stylus
npm http 304 https://registry.npmjs.org/node-sass
npm http 304 https://registry.npmjs.org/less
npm http 304 https://registry.npmjs.org/styl
npm http GET https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/jsdom
npm http GET https://registry.npmjs.org/batch
npm http GET https://registry.npmjs.org/superagent
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/slick
npm http GET https://registry.npmjs.org/delayed-stream
npm http GET https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/css-whitespace
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/rework
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/stdin
npm http GET https://registry.npmjs.org/rework-mixins
npm http GET https://registry.npmjs.org/uglify-js
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/css-parse
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/sax
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/uglify-js
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/transformers
npm http GET https://registry.npmjs.org/character-parser
npm http GET https://registry.npmjs.org/monocle
npm http GET https://registry.npmjs.org/with
npm http GET https://registry.npmjs.org/constantinople
npm http 304 https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/node-watch
npm http GET https://registry.npmjs.org/chalk
npm http GET https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/mocha
npm http GET https://registry.npmjs.org/sinon
npm http 304 https://registry.npmjs.org/jsdom
npm http 304 https://registry.npmjs.org/batch
npm http 304 https://registry.npmjs.org/superagent
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/slick
npm http 304 https://registry.npmjs.org/minimatch
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/delayed-stream
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/rework
npm http 304 https://registry.npmjs.org/css-whitespace
npm http GET https://registry.npmjs.org/keypress
npm http 304 https://registry.npmjs.org/stdin
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/formidable
npm http GET https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/uglify-js
npm http GET https://registry.npmjs.org/emitter-component
npm http GET https://registry.npmjs.org/cookiejar
npm http GET https://registry.npmjs.org/methods
npm http 304 https://registry.npmjs.org/css-parse
npm http GET https://registry.npmjs.org/htmlparser
npm http GET https://registry.npmjs.org/nwmatcher
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/cssstyle
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/rework-mixins
npm http 304 https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/source-map
npm http GET https://registry.npmjs.org/clean-css
npm http 304 https://registry.npmjs.org/uglify-js
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/sax
npm http GET https://registry.npmjs.org/css
npm http GET https://registry.npmjs.org/color-parser
npm http GET https://registry.npmjs.org/hsb2rgb
npm http GET https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/rework-inherit
npm http GET https://registry.npmjs.org/rework-visit
npm http GET https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/minimist
npm http 304 https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/source-map
npm http GET https://registry.npmjs.org/uglify-to-browserify
npm http 304 https://registry.npmjs.org/transformers
npm http GET https://registry.npmjs.org/source-map
npm http 304 https://registry.npmjs.org/character-parser
npm http 304 https://registry.npmjs.org/monocle
npm http 304 https://registry.npmjs.org/with
npm http 304 https://registry.npmjs.org/constantinople
npm http 304 https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/readdirp
npm http GET https://registry.npmjs.org/promise
npm http GET https://registry.npmjs.org/css
npm http 304 https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/mocha
npm http 304 https://registry.npmjs.org/node-watch
npm http 304 https://registry.npmjs.org/chalk
npm http 304 https://registry.npmjs.org/lru-cache
npm http 304 https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/keypress
npm http 304 https://registry.npmjs.org/sinon
npm http 304 https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/has-color
npm http GET https://registry.npmjs.org/ansi-styles
npm http GET https://registry.npmjs.org/strip-ansi
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/cookiejar
npm http GET https://registry.npmjs.org/growl
npm http GET https://registry.npmjs.org/diff
npm http GET https://registry.npmjs.org/formatio
npm http GET https://registry.npmjs.org/util
npm http 304 https://registry.npmjs.org/methods
npm http 304 https://registry.npmjs.org/formidable
npm http 304 https://registry.npmjs.org/emitter-component
npm http 304 https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/htmlparser
npm http 304 https://registry.npmjs.org/nwmatcher
npm http 304 https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/cssstyle
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/forever-agent
npm http GET https://registry.npmjs.org/node-uuid
npm http GET https://registry.npmjs.org/tough-cookie
npm http GET https://registry.npmjs.org/form-data
npm http GET https://registry.npmjs.org/tunnel-agent
npm http GET https://registry.npmjs.org/http-signature
npm http GET https://registry.npmjs.org/oauth-sign
npm http GET https://registry.npmjs.org/aws-sign2
npm http GET https://registry.npmjs.org/hawk
npm http 304 https://registry.npmjs.org/css
npm http 304 https://registry.npmjs.org/color-parser
npm http 304 https://registry.npmjs.org/source-map
npm http 304 https://registry.npmjs.org/clean-css
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/hsb2rgb
npm http 304 https://registry.npmjs.org/rework-visit
npm http 304 https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/amdefine
npm http 304 https://registry.npmjs.org/source-map
npm http 304 https://registry.npmjs.org/uglify-to-browserify
npm http 304 https://registry.npmjs.org/source-map
npm http 304 https://registry.npmjs.org/rework-inherit
npm http 304 https://registry.npmjs.org/minimist
npm http 304 https://registry.npmjs.org/readdirp
npm http 304 https://registry.npmjs.org/css
npm http 304 https://registry.npmjs.org/ansi-styles
npm http 304 https://registry.npmjs.org/has-color
npm http GET https://registry.npmjs.org/css-stringify
npm http 304 https://registry.npmjs.org/strip-ansi
npm http 304 https://registry.npmjs.org/promise
npm http 304 https://registry.npmjs.org/growl
npm http GET https://registry.npmjs.org/is-promise
npm http GET https://registry.npmjs.org/css-stringify
npm http 304 https://registry.npmjs.org/formatio
npm http 304 https://registry.npmjs.org/diff
npm http 304 https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/util
npm http 304 https://registry.npmjs.org/json-stringify-safe
npm http 304 https://registry.npmjs.org/forever-agent
npm http 304 https://registry.npmjs.org/node-uuid
npm http 304 https://registry.npmjs.org/form-data
npm http 304 https://registry.npmjs.org/tunnel-agent
npm http GET https://registry.npmjs.org/samsam
npm http 304 https://registry.npmjs.org/tough-cookie
npm http 304 https://registry.npmjs.org/http-signature
npm http 304 https://registry.npmjs.org/oauth-sign

> [email protected] install /home/michael/scm/temp/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild

Traceback (most recent call last):
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 18, in <module>
    sys.exit(gyp.script_main())
AttributeError: 'module' object has no attribute 'script_main'
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:340:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:807:12)
gyp ERR! System Linux 3.11.0-12-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/michael/scm/temp/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.10.28
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok 
npm http 304 https://registry.npmjs.org/aws-sign2
npm http GET https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/hawk
npm http 304 https://registry.npmjs.org/is-promise
npm http 304 https://registry.npmjs.org/amdefine
npm http GET https://registry.npmjs.org/assert-plus
npm http GET https://registry.npmjs.org/ctype
npm http GET https://registry.npmjs.org/asn1
npm http 304 https://registry.npmjs.org/css-stringify
npm http 304 https://registry.npmjs.org/css-stringify
npm http 304 https://registry.npmjs.org/samsam
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/ctype
npm http 304 https://registry.npmjs.org/asn1
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/home/michael/scm/temp/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/request/node_modules/hawk'
npm ERR! error rolling back  [email protected] { [Error: ENOTEMPTY, rmdir '/home/michael/scm/temp/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/request/node_modules/hawk']
npm ERR! error rolling back   errno: 53,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   path: '/home/michael/scm/temp/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/request/node_modules/hawk' }
npm ERR! Error: ENOENT, lstat '/home/michael/scm/temp/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/request/node_modules/tough-cookie/lib/cookie.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "email-templates"
npm ERR! cwd /home/michael/scm/temp
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! path /home/michael/scm/temp/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/request/node_modules/tough-cookie/lib/cookie.js
npm ERR! fstream_path /home/michael/scm/temp/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/request/node_modules/tough-cookie/lib/cookie.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/home/michael/scm/temp/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/request/node_modules/hawk/lib/browser.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "email-templates"
npm ERR! cwd /home/michael/scm/temp
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! path /home/michael/scm/temp/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/request/node_modules/hawk/lib/browser.js
npm ERR! fstream_path /home/michael/scm/temp/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/request/node_modules/hawk/lib/browser.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/home/michael/scm/temp/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/request/node_modules/form-data/node_modules/async/README.md'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "email-templates"
npm ERR! cwd /home/michael/scm/temp
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! path /home/michael/scm/temp/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/request/node_modules/form-data/node_modules/async/README.md
npm ERR! fstream_path /home/michael/scm/temp/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/request/node_modules/form-data/node_modules/async/README.md
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/home/michael/scm/temp/node_modules/email-templates/node_modules/less/node_modules/request/node_modules/node-uuid/benchmark/bench.sh'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "email-templates"
npm ERR! cwd /home/michael/scm/temp
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! path /home/michael/scm/temp/node_modules/email-templates/node_modules/less/node_modules/request/node_modules/node-uuid/benchmark/bench.sh
npm ERR! fstream_path /home/michael/scm/temp/node_modules/email-templates/node_modules/less/node_modules/request/node_modules/node-uuid/benchmark/bench.sh
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, utime '/home/michael/scm/temp/node_modules/email-templates/node_modules/node-sass/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/open.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "email-templates"
npm ERR! cwd /home/michael/scm/temp
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! path /home/michael/scm/temp/node_modules/email-templates/node_modules/node-sass/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/open.js
npm ERR! fstream_path /home/michael/scm/temp/node_modules/email-templates/node_modules/node-sass/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/open.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call utimes
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/home/michael/scm/temp/node_modules/email-templates/node_modules/jade/node_modules/transformers/node_modules/uglify-js/node_modules/optimist'
npm ERR! error rolling back  [email protected] { [Error: ENOTEMPTY, rmdir '/home/michael/scm/temp/node_modules/email-templates/node_modules/jade/node_modules/transformers/node_modules/uglify-js/node_modules/optimist']
npm ERR! error rolling back   errno: 53,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   path: '/home/michael/scm/temp/node_modules/email-templates/node_modules/jade/node_modules/transformers/node_modules/uglify-js/node_modules/optimist' }
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls contextify
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "email-templates"
npm ERR! cwd /home/michael/scm/temp
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR! Error: ENOENT, lstat '/home/michael/scm/temp/node_modules/email-templates/node_modules/jade/node_modules/constantinople/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/amdefine.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "email-templates"
npm ERR! cwd /home/michael/scm/temp
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! path /home/michael/scm/temp/node_modules/email-templates/node_modules/jade/node_modules/constantinople/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/amdefine.js
npm ERR! fstream_path /home/michael/scm/temp/node_modules/email-templates/node_modules/jade/node_modules/constantinople/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/amdefine.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/home/michael/scm/temp/node_modules/email-templates/node_modules/less/node_modules/request/node_modules/http-signature/lib/signer.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "email-templates"
npm ERR! cwd /home/michael/scm/temp
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! path /home/michael/scm/temp/node_modules/email-templates/node_modules/less/node_modules/request/node_modules/http-signature/lib/signer.js
npm ERR! fstream_path /home/michael/scm/temp/node_modules/email-templates/node_modules/less/node_modules/request/node_modules/http-signature/lib/signer.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! EEXIST, mkdir '/home/michael/scm/temp/node_modules/email-templates/node_modules/jade/node_modules/monocle/node_modules/readdirp/examples/node_modules/event-stream/node_modules/through/test'
File exists: /home/michael/scm/temp/node_modules/email-templates/node_modules/jade/node_modules/monocle/node_modules/readdirp/examples/node_modules/event-stream/node_modules/through/test
Move it away, and try again. 

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "email-templates"
npm ERR! cwd /home/michael/scm/temp
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! path /home/michael/scm/temp/node_modules/email-templates/node_modules/jade/node_modules/monocle/node_modules/readdirp/examples/node_modules/event-stream/node_modules/through/test
npm ERR! fstream_path /home/michael/scm/temp/node_modules/email-templates/node_modules/jade/node_modules/monocle/node_modules/readdirp/examples/node_modules/event-stream/node_modules/through/test/end.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:171:23
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/home/michael/scm/temp/node_modules/email-templates/node_modules/node-sass/node_modules/mocha/node_modules/glob/node_modules/minimatch/minimatch.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "email-templates"
npm ERR! cwd /home/michael/scm/temp
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! path /home/michael/scm/temp/node_modules/email-templates/node_modules/node-sass/node_modules/mocha/node_modules/glob/node_modules/minimatch/minimatch.js
npm ERR! fstream_path /home/michael/scm/temp/node_modules/email-templates/node_modules/node-sass/node_modules/mocha/node_modules/glob/node_modules/minimatch/minimatch.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/home/michael/scm/temp/node_modules/email-templates/node_modules/node-sass/node_modules/mocha/node_modules/jade/node_modules/commander'
npm ERR! error rolling back  [email protected] { [Error: ENOTEMPTY, rmdir '/home/michael/scm/temp/node_modules/email-templates/node_modules/node-sass/node_modules/mocha/node_modules/jade/node_modules/commander']
npm ERR! error rolling back   errno: 53,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   path: '/home/michael/scm/temp/node_modules/email-templates/node_modules/node-sass/node_modules/mocha/node_modules/jade/node_modules/commander' }
npm ERR! Error: ENOENT, lstat '/home/michael/scm/temp/node_modules/email-templates/node_modules/node-sass/node_modules/mocha/node_modules/jade/node_modules/mkdirp/README.markdown'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "email-templates"
npm ERR! cwd /home/michael/scm/temp
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! path /home/michael/scm/temp/node_modules/email-templates/node_modules/node-sass/node_modules/mocha/node_modules/jade/node_modules/mkdirp/README.markdown
npm ERR! fstream_path /home/michael/scm/temp/node_modules/email-templates/node_modules/node-sass/node_modules/mocha/node_modules/jade/node_modules/mkdirp/README.markdown
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm http 304 https://registry.npmjs.org/assert-plus

npm WARN optional dep failed, continuing [email protected]
npm http GET https://registry.npmjs.org/punycode
npm http GET https://registry.npmjs.org/boom
npm http GET https://registry.npmjs.org/hoek
npm http GET https://registry.npmjs.org/cryptiles
npm http GET https://registry.npmjs.org/sntp
npm http 304 https://registry.npmjs.org/punycode
npm http 304 https://registry.npmjs.org/cryptiles
npm http 304 https://registry.npmjs.org/boom
npm http 304 https://registry.npmjs.org/hoek
npm http 304 https://registry.npmjs.org/sntp
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/michael/scm/temp/npm-debug.log
npm ERR! not ok code 0

michael@mc-desktop ~/scm/temp
โ˜”  

CSS is ignored if you donโ€™t have a text.ejs

If your template doesnโ€™t have a text.ejs file, then your style.css is ignored.

My understanding is that style.css is used to add inline styles to the HTML version of your e-mail (that is, html.ejs), so it should work regardless of whether text.ejs is present or not.

To reproduce

  • Create a project. npm install email-templates.
  • Create a directory called templates and copy the entire pasta-dinner example template there (including html.ejs, text.ejs and style.css).
  • Run the following app:
var path           = require('path')
  , templatesDir   = path.join(__dirname, 'templates')
  , emailTemplates = require('email-templates');

emailTemplates(templatesDir, function(err, template) {
  template('pasta-dinner', {pasta: 'Spaghetti'}, function(err, html, text) {
    console.log('html is:', html);
  });
});
  • Note that everything works as expected, and the <h1> style is inlined.
  • Now delete templates/pasta-dinner/text.ejs.
  • Run the app again.

Expected results

The HTML output should be the same as before, including the inlined <h1> style.

Acutal results

Styles from style.css are not present.

Regards,
Nate

Don't filter out css properties

For some reason some properties don't make it through to the email. In paricular the box-shadow property does not even end up in the html file sent to nodemailer.

The api should be a bit more modular.

Having to call emailTemplate(dir, next) every time you want to process some templates introduces a lot of overheard. It would be nice if the templates could be cached.

Unable to get email templates to work, no such file or directory errors

I have followed the instructions on the homepage and was unable to get email-templates to work. I have tried both absolute as relative paths, all to no avail. Finally I decided to try and get the example to work. Here is what I did:

Download and extract zip file of node-email-templates-master and:

cd node-email-templates-master

npm install

npm install [email protected]

cd examples/nodemailer

node index

I am getting the same errors as before:

fs.js:338
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT, no such file or directory '../header/html.ejs'
    at Object.fs.openSync (fs.js:338:18)
    at fs.readFileSync (fs.js:182:15)
    at Object.exports.parse (/mypath/node-email-templates-master/node_modules/ejs/lib/ejs.js:159:19)
    at exports.compile (/mypath/node-email-templates-master/node_modules/ejs/lib/ejs.js:222:15)
    at Object.exports.render (/mypath/node-email-templates-master/node_modules/ejs/lib/ejs.js:273:10)
    at EmailTemplate.render (/mypath/node-email-templates-master/lib/main.js:63:16)
    at Render.batch (/mypath/node-email-templates-master/examples/nodemailer/index.js:118:9)
    at /mypath/node-email-templates-master/examples/nodemailer/index.js:126:16
    at fs.stat.batchCheck (/mypath/node-email-templates-master/lib/main.js:130:18)

I am running node version 0.8.12

Cannot install version 0.1.4

I've got the following error during installation:

[email protected] install /usr/lib/node_modules/contextify
node-gyp rebuild

Traceback (most recent call last):
File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 18, in
sys.exit(gyp.script_main())
File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 534, in script_main
return main(sys.argv[1:])
File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 527, in main
return gyp_main(args)
File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 503, in gyp_main
options.circular_check)
File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 129, in Load
params['parallel'], params['root_targets'])
File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2687, in Load
generator_input_info)
File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 594, in LoadTargetBuildFilesParallel
parallel_state.pool = multiprocessing.Pool(8)
File "/usr/lib/python2.7/multiprocessing/init.py", line 232, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild)
File "/usr/lib/python2.7/multiprocessing/pool.py", line 115, in init
self._setup_queues()
File "/usr/lib/python2.7/multiprocessing/pool.py", line 210, in _setup_queues
self._inqueue = SimpleQueue()
File "/usr/lib/python2.7/multiprocessing/queues.py", line 352, in init
self._rlock = Lock()
File "/usr/lib/python2.7/multiprocessing/synchronize.py", line 147, in init
SemLock.init(self, SEMAPHORE, 1, 1)
File "/usr/lib/python2.7/multiprocessing/synchronize.py", line 75, in init
sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue)
OSError: [Errno 13] Permission denied

root didn't help

npm install fails

pm ERR! error installing [email protected]
npm http GET https://registry.npmjs.org/ejs/-/ejs-0.8.3.tgz
npm http GET https://registry.npmjs.org/async/-/async-0.1.22.tgz
npm ERR! Error: No compatible version found: juice@'>=0.3.2- <0.4.0-'
npm ERR! Valid install targets:
npm ERR! ["0.0.1","0.0.2","0.0.3","0.0.4","0.0.5","0.0.6","0.0.7","0.0.8","0.0.9","0.1.0","0.1.1","0.1.2","0.1.3","0.2.0"]
npm ERR! at installTargetsError (/usr/local/lib/node_modules/npm/lib/cache.js:488:10)
npm ERR! at next_ (/usr/local/lib/node_modules/npm/lib/cache.js:438:17)
npm ERR! at next (/usr/local/lib/node_modules/npm/lib/cache.js:415:44)
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache.js:408:5
npm ERR! at Object.saved [as oncomplete] (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR! Report this entire log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]
npm ERR!
npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "email-templates"
npm ERR! cwd /Users/.../dev/svnhook/processor
npm ERR! node -v v0.6.7
npm ERR! npm -v 1.1.0-beta-10
npm ERR! message No compatible version found: juice@'>=0.3.2- <0.4.0-'
npm ERR! message Valid install targets:
npm ERR! message ["0.0.1","0.0.2","0.0.3","0.0.4","0.0.5","0.0.6","0.0.7","0.0.8","0.0.9","0.1.0","0.1.1","0.1.2","0.1.3","0.2.0"]
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/.../processor/npm-debug.log
npm not ok

Handlebars partial support

I'm trying to figure out how to use handlebars partials but can't figure a way to do so. Is there a way to do this? I would make my email templates a lot DRYer.

Deprecate windows branch

There is currently no major difference between the master and windows branches so it would make sense to deprecate the windows one.

$ diff email-templates/package.json email-templates-windows/package.json
2c2
<   "name": "email-templates",

---
>   "name": "email-templates-windows",
4c4
<   "version": "0.1.4",

---
>   "version": "0.1.5",

The only reason windows users would have trouble using this repo is related to the contextify's dependency on jsdom and contextify is required by juice and maintaining a separate branch won't solve that. Any workaround for windows users should be documented and added to the README.

has no method 'slice'

hi
I tried to send a multiple mail with node-email-template and i used the follow code:

emailTemplates(templatesDir, function(err, template) {

if (err) {
console.log(err);
} else {

// ## Send a batch of emails and only load the template once

// Prepare nodemailer transport object
var transportBatch = nodemailer.createTransport("SMTP", {
  service: "Gmail",
  auth: {
    user: "[email protected]",
    pass: "some-password"
  }
});

// An example users object
var users = [
  {
    email: '[email protected]',
    name: {
      first: 'Pappa',
      last: 'Pizza'
    }
  },
  {
    email: '[email protected]',
    name: {
      first: 'Mister',
      last: 'Geppetto'
    }
  }
];

// Custom function for sending emails outside the loop
//
// NOTE:
//  We need to patch postmark.js module to support the API call
//  that will let us send a batch of up to 500 messages at once.
//  (e.g. <https://github.com/diy/trebuchet/blob/master/lib/index.js#L160>)
var Render = function(locals) {
  this.locals = locals;
  this.send = function(err, html, text) {
    if (err) {
      console.log(err);
    } else {
      transportBatch.sendMail({
        from: 'Spicy Meatball <[email protected]>',
        to: locals.email,
        subject: 'Mangia gli spaghetti con polpette!',
        html: html,
        // generateTextFromHTML: true,
        text: text
      }, function(err, responseStatus) {
        if (err) {
          console.log(err);
        } else {
          console.log(responseStatus.message);
        }
      });
    }
  };
  this.batch = function(batch) {
    batch(this.locals, this.send);
  };
};

// Load the template and send the emails
template('newsletter', true, function(err, batch) {
  for(var user in users) {
    var render = new Render(users[user]);
    render.batch(batch);
  }
});

}
});

but it's dont work and return this error:

/usr/lib/nodejs/email-templates/node_modules/ejs/lib/ejs.js:123
if (str.slice(i, open.length + i) == open) {
^
TypeError: Object function (err, html, text) {
if (err) {
console.log(err);
} else {
transportBatch.sendMail({
from: 'Spicy Meatball [email protected]',
to: locals.email,
subject: 'Mangia gli spaghetti con polpette!',
html: html,
// generateTextFromHTML: true,
text: text
}, function(err, responseStatus) {
if (err) {
console.log(err);
} else {
console.log(responseStatus.message);
}
});
}
} has no method 'slice'
at Object.parse (/usr/lib/nodejs/email-templates/node_modules/ejs/lib/ejs.js:123:13)
at /usr/lib/nodejs/email-templates/node_modules/ejs/lib/ejs.js:202:13
at Object.render (/usr/lib/nodejs/email-templates/node_modules/ejs/lib/ejs.js:245:10)
at /usr/lib/nodejs/email-templates/lib/main.js:58:16
at [object Object].batch (/var/www/id/nodejs/socket.js:913:9)
at /var/www/id/nodejs/socket.js:921:16
at /usr/lib/nodejs/email-templates/lib/main.js:124:18
at /usr/lib/nodejs/email-templates/lib/main.js:184:19
at /usr/lib/nodejs/email-templates/node_modules/async/lib/async.js:190:13
at /usr/lib/nodejs/email-templates/node_modules/async/lib/async.js:94:25

Can you help me to fix this error?

thanks in advance!

npm install email-templates fails

I can't install email-templates via npm

I'm using a prefixed install of node v0.10.22 on fedora x86-64 linux.

verbose npm install output is here: http://www.filedropper.com/out_1
npm-debug.log here: http://www.filedropper.com/npm-debug

terse output below:

npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] crypto is also the name of a node core module.
npm http GET https://registry.npmjs.org/email-templates
npm http 304 https://registry.npmjs.org/email-templates
npm http GET https://registry.npmjs.org/async/0.1.22
npm http GET https://registry.npmjs.org/underscore/1.3.3
npm http GET https://registry.npmjs.org/ejs/0.8.3
npm http GET https://registry.npmjs.org/juice
npm http 304 https://registry.npmjs.org/underscore/1.3.3
npm http 304 https://registry.npmjs.org/async/0.1.22
npm http 304 https://registry.npmjs.org/juice
npm http 304 https://registry.npmjs.org/ejs/0.8.3
npm http GET https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/superagent
npm http GET https://registry.npmjs.org/batch
npm http GET https://registry.npmjs.org/jsdom
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/slick
npm http 304 https://registry.npmjs.org/batch
npm http 304 https://registry.npmjs.org/jsdom
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/superagent
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/slick
npm http GET https://registry.npmjs.org/keypress
npm http GET https://registry.npmjs.org/qs/0.6.5
npm http GET https://registry.npmjs.org/formidable/1.0.9
npm http GET https://registry.npmjs.org/mime/1.2.5
npm http GET https://registry.npmjs.org/methods/0.0.1
npm http GET https://registry.npmjs.org/emitter-component/1.0.0
npm http GET https://registry.npmjs.org/cssstyle
npm http GET https://registry.npmjs.org/htmlparser
npm http GET https://registry.npmjs.org/nwmatcher
npm http GET https://registry.npmjs.org/cookiejar/1.3.0
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/keypress
npm http 304 https://registry.npmjs.org/qs/0.6.5
npm http 304 https://registry.npmjs.org/methods/0.0.1
npm http 304 https://registry.npmjs.org/formidable/1.0.9
npm http 304 https://registry.npmjs.org/emitter-component/1.0.0
npm http 304 https://registry.npmjs.org/mime/1.2.5
npm http 304 https://registry.npmjs.org/cssstyle
npm http 304 https://registry.npmjs.org/htmlparser
npm http 304 https://registry.npmjs.org/cookiejar/1.3.0
npm http 304 https://registry.npmjs.org/nwmatcher
npm http 304 https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/forever-agent
npm http GET https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/node-uuid
npm http GET https://registry.npmjs.org/tough-cookie
npm http GET https://registry.npmjs.org/form-data
npm http GET https://registry.npmjs.org/tunnel-agent
npm http GET https://registry.npmjs.org/oauth-sign
npm http GET https://registry.npmjs.org/http-signature
npm http GET https://registry.npmjs.org/hawk
npm http GET https://registry.npmjs.org/aws-sign2
npm http 304 https://registry.npmjs.org/json-stringify-safe
npm http 304 https://registry.npmjs.org/qs
npm http 304 https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/forever-agent
npm http 304 https://registry.npmjs.org/mime

[email protected] install /mnt/raid/src/web/jobSearch/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/contextify
node-gyp rebuild

make: Entering directory /mnt/raid/src/web/jobSearch/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/contextify/build' CXX(target) Release/obj.target/contextify/src/contextify.o SOLINK_MODULE(target) Release/obj.target/contextify.node flock: ./Release/linker.lock: Bad file descriptor make: *** [Release/obj.target/contextify.node] Error 65 make: Leaving directory/mnt/raid/src/web/jobSearch/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/contextify/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/mnt/raid/local/node-v0.10.22-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.11.9-200.fc19.x86_64
gyp ERR! command "node" "/mnt/raid/local/node-v0.10.22-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /mnt/raid/src/web/jobSearch/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.10.22
gyp ERR! node-gyp -v v0.11.0
gyp ERR! not ok
npm http 304 https://registry.npmjs.org/node-uuid
npm http 304 https://registry.npmjs.org/tough-cookie
npm http 304 https://registry.npmjs.org/form-data
npm http 304 https://registry.npmjs.org/tunnel-agent
npm http 304 https://registry.npmjs.org/oauth-sign
npm http 304 https://registry.npmjs.org/hawk
npm http 304 https://registry.npmjs.org/aws-sign2
npm http 304 https://registry.npmjs.org/http-signature
npm http GET https://registry.npmjs.org/combined-stream
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/assert-plus/0.1.2
npm http GET https://registry.npmjs.org/asn1/0.1.11
npm http GET https://registry.npmjs.org/ctype/0.5.2
npm http GET https://registry.npmjs.org/punycode
npm http GET https://registry.npmjs.org/cryptiles
npm http GET https://registry.npmjs.org/sntp
npm http GET https://registry.npmjs.org/boom
npm http GET https://registry.npmjs.org/hoek
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls contextify
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.11.9-200.fc19.x86_64
npm ERR! command "/mnt/raid/local/bin/node" "/mnt/raid/local/bin/npm" "install" "email-templates"
npm ERR! cwd /mnt/raid/src/web/jobSearch
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! code ELIFECYCLE
npm http 304 https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/combined-stream
npm http 304 https://registry.npmjs.org/assert-plus/0.1.2
npm http 304 https://registry.npmjs.org/asn1/0.1.11
npm http 304 https://registry.npmjs.org/ctype/0.5.2
npm http GET https://registry.npmjs.org/delayed-stream/0.0.5
npm http 304 https://registry.npmjs.org/punycode
npm http 304 https://registry.npmjs.org/cryptiles
npm http 304 https://registry.npmjs.org/sntp
npm http 304 https://registry.npmjs.org/boom
npm http 304 https://registry.npmjs.org/hoek
npm http 304 https://registry.npmjs.org/delayed-stream/0.0.5
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /mnt/raid/src/web/jobSearch/npm-debug.log
npm ERR! not ok code 0

send email as a queue

Is there a way to use this module with a queue emailer?

I'd like to send out an email to all users that are associated with an account when an action is taken, but that may cause the page to not return for quite a while when sending the emails.

long path issue

Windows has limitation for max characters in path. This module creates a lot of sub modules and its not possible to check out projects which has committed whole node_module directory.
This can be simply fix by adding

"combined-stream": "~0.0.4"

to package.json

Could you do that?

Nodemailer batch email templates not rendering

I took the Nodemailer batch example from the Readme

var path           = require('path')
  , templatesDir   = path.resolve(__dirname, '..', 'templates')
  , emailTemplates = require('email-templates')
  , nodemailer     = require('nodemailer');

emailTemplates(templatesDir, function(err, template) {

  if (err) {
    console.log(err);
  } else {

    // ## Send a batch of emails and only load the template once

    // Prepare nodemailer transport object
    var transportBatch = nodemailer.createTransport("SMTP", {
      service: "Gmail",
      auth: {
        user: "[email protected]",
        pass: "some-password"
      }
    });

    // An example users object
    var users = [
      {
        email: '[email protected]',
        name: {
          first: 'Pappa',
          last: 'Pizza'
        }
      },
      {
        email: '[email protected]',
        name: {
          first: 'Mister',
          last: 'Geppetto'
        }
      }
    ];

    // Custom function for sending emails outside the loop
    //
    // NOTE:
    //  We need to patch postmark.js module to support the API call
    //  that will let us send a batch of up to 500 messages at once.
    //  (e.g. <https://github.com/diy/trebuchet/blob/master/lib/index.js#L160>)
    var Render = function(locals) {
      this.locals = locals;
      this.send = function(err, html, text) {
        if (err) {
          console.log(err);
        } else {
          transportBatch.sendMail({
            from: 'Spicy Meatball <[email protected]>',
            to: locals.email,
            subject: 'Mangia gli spaghetti con polpette!',
            html: html,
            // generateTextFromHTML: true,
            text: text
          }, function(err, responseStatus) {
            if (err) {
              console.log(err);
            } else {
              console.log(responseStatus.message);
            }
          });
        }
      };
      this.batch = function(batch) {
        batch(this.locals, templatesDir, this.send);
      };
    };

    // Load the template and send the emails
    template('newsletter', true, function(err, batch) {
      for(var user in users) {
        var render = new Render(users[user]);
        render.batch(batch);
      }
    });

  }
});

and sent myself the emails, but here's what I received in my inbox

Hi there <%= name.first %> <%= name.last %>

Poking around at the source code I found that options.filename in templateManager.render() is undefined which explains why the ejs engine render function did not get called. Somewhere in EmailTemplate() the templateName is not being appended to locals.templatePath.

npm install fails on mac osx 10.9.3

node -v
v0.10.28

npm http GET https://registry.npmjs.org/email-templates
npm http 304 https://registry.npmjs.org/email-templates
npm WARN engine [email protected]: wanted: {"node":"0.8.x | 0.10.x"} (current: {"node":"v0.10.28","npm":"1.4.9"})
npm http GET https://registry.npmjs.org/ejs
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/juice
npm http GET https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/combined-stream
npm http GET https://registry.npmjs.org/swig
npm http GET https://registry.npmjs.org/jade
npm http GET https://registry.npmjs.org/styl
npm http GET https://registry.npmjs.org/handlebars
npm http GET https://registry.npmjs.org/node-sass
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/stylus
npm http GET https://registry.npmjs.org/less
npm http 304 https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/ejs
npm http 304 https://registry.npmjs.org/combined-stream
npm http 304 https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/jade
npm http 304 https://registry.npmjs.org/swig
npm http 304 https://registry.npmjs.org/styl
npm http 304 https://registry.npmjs.org/handlebars
npm http 304 https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/less
npm http 304 https://registry.npmjs.org/stylus
npm http 304 https://registry.npmjs.org/juice
npm http 304 https://registry.npmjs.org/node-sass
npm http GET https://registry.npmjs.org/batch
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/slick
npm http GET https://registry.npmjs.org/superagent
npm http GET https://registry.npmjs.org/jsdom
npm http GET https://registry.npmjs.org/delayed-stream
npm http GET https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/css-whitespace
npm http GET https://registry.npmjs.org/rework
npm http GET https://registry.npmjs.org/stdin
npm http GET https://registry.npmjs.org/rework-mixins
npm http GET https://registry.npmjs.org/uglify-js
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/css-parse
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/sax
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/uglify-js
npm http 304 https://registry.npmjs.org/batch
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/character-parser
npm http GET https://registry.npmjs.org/transformers
npm http GET https://registry.npmjs.org/with
npm http GET https://registry.npmjs.org/constantinople
npm http GET https://registry.npmjs.org/monocle
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/superagent
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/slick
npm http 304 https://registry.npmjs.org/delayed-stream
npm http 304 https://registry.npmjs.org/minimatch
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/css-whitespace
npm http 304 https://registry.npmjs.org/jsdom
npm http 304 https://registry.npmjs.org/rework
npm http 304 https://registry.npmjs.org/rework-mixins
npm http 304 https://registry.npmjs.org/stdin
npm http GET https://registry.npmjs.org/keypress
npm http 304 https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/css-parse
npm http GET https://registry.npmjs.org/css
npm http GET https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/color-parser
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/formidable
npm http GET https://registry.npmjs.org/hsb2rgb
npm http GET https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/emitter-component
npm http GET https://registry.npmjs.org/cookiejar
npm http GET https://registry.npmjs.org/rework-inherit
npm http GET https://registry.npmjs.org/rework-visit
npm http GET https://registry.npmjs.org/methods
npm http 304 https://registry.npmjs.org/uglify-js
npm http 304 https://registry.npmjs.org/uglify-js
npm http 304 https://registry.npmjs.org/sax
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/htmlparser
npm http GET https://registry.npmjs.org/nwmatcher
npm http GET https://registry.npmjs.org/cssstyle
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/character-parser
npm http GET https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/minimist
npm http 304 https://registry.npmjs.org/transformers
npm http 304 https://registry.npmjs.org/with
npm http 304 https://registry.npmjs.org/constantinople
npm http GET https://registry.npmjs.org/source-map
npm http 304 https://registry.npmjs.org/monocle
npm http 304 https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/uglify-to-browserify
npm http GET https://registry.npmjs.org/source-map
npm http 304 https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/keypress
npm http GET https://registry.npmjs.org/readdirp
npm http GET https://registry.npmjs.org/css
npm http GET https://registry.npmjs.org/promise
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/qs
npm http 304 https://registry.npmjs.org/css
npm http 304 https://registry.npmjs.org/formidable
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/color-parser
npm http 304 https://registry.npmjs.org/hsb2rgb
npm http GET https://registry.npmjs.org/node-watch
npm http GET https://registry.npmjs.org/chalk
npm http GET https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/mocha
npm http GET https://registry.npmjs.org/sinon
npm http 304 https://registry.npmjs.org/cookiejar
npm http 304 https://registry.npmjs.org/rework-inherit
npm http 304 https://registry.npmjs.org/methods
npm http 304 https://registry.npmjs.org/htmlparser
npm http 304 https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/source-map
npm http GET https://registry.npmjs.org/clean-css
npm http 304 https://registry.npmjs.org/rework-visit
npm http 304 https://registry.npmjs.org/emitter-component
npm http 304 https://registry.npmjs.org/nwmatcher
npm http 304 https://registry.npmjs.org/cssstyle
npm http 304 https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/css-stringify
npm http 304 https://registry.npmjs.org/wordwrap
npm http 304 https://registry.npmjs.org/minimist
npm http 304 https://registry.npmjs.org/source-map
npm http 304 https://registry.npmjs.org/source-map
npm http GET https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/promise
npm http 304 https://registry.npmjs.org/uglify-to-browserify
npm http 304 https://registry.npmjs.org/readdirp
npm http 304 https://registry.npmjs.org/css
npm http GET https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/forever-agent
npm http GET https://registry.npmjs.org/node-uuid
npm http GET https://registry.npmjs.org/tough-cookie
npm http GET https://registry.npmjs.org/form-data
npm http GET https://registry.npmjs.org/tunnel-agent
npm http GET https://registry.npmjs.org/http-signature
npm http GET https://registry.npmjs.org/oauth-sign
npm http GET https://registry.npmjs.org/aws-sign2
npm http GET https://registry.npmjs.org/hawk
npm http 304 https://registry.npmjs.org/node-watch
npm http 304 https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/chalk
npm http GET https://registry.npmjs.org/is-promise
npm http 304 https://registry.npmjs.org/source-map
npm http GET https://registry.npmjs.org/css-stringify
npm http 304 https://registry.npmjs.org/mocha
npm http 304 https://registry.npmjs.org/sinon
npm http 304 https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/css-stringify
npm http GET https://registry.npmjs.org/ansi-styles
npm http GET https://registry.npmjs.org/has-color
npm http GET https://registry.npmjs.org/strip-ansi
npm http 304 https://registry.npmjs.org/clean-css
npm http 304 https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/amdefine
npm http 304 https://registry.npmjs.org/json-stringify-safe
npm http 304 https://registry.npmjs.org/node-uuid
npm http 304 https://registry.npmjs.org/forever-agent
npm http 304 https://registry.npmjs.org/tough-cookie
npm http 304 https://registry.npmjs.org/form-data
npm http 304 https://registry.npmjs.org/oauth-sign
npm http 304 https://registry.npmjs.org/tunnel-agent
npm http 304 https://registry.npmjs.org/http-signature
npm http 304 https://registry.npmjs.org/aws-sign2
npm http 304 https://registry.npmjs.org/css-stringify

[email protected] install /Users/leedorian/works/chetang.oschina/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/contextify
node-gyp rebuild

gyp http GET http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz
gyp http 200 http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz
gyp ERR! Completion callback never invoked!
gyp ERR! System Darwin 13.2.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/leedorian/works/chetang.oschina/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.10.28
gyp ERR! node-gyp -v v0.13.0
gyp ERR! This is a bug in node-gyp.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! https://github.com/TooTallNate/node-gyp/issues
npm http 304 https://registry.npmjs.org/hawk
npm http 304 https://registry.npmjs.org/is-promise
npm http 304 https://registry.npmjs.org/ansi-styles
npm http 304 https://registry.npmjs.org/has-color
npm http 304 https://registry.npmjs.org/strip-ansi
npm http 304 https://registry.npmjs.org/amdefine
npm http GET https://registry.npmjs.org/ctype
npm http GET https://registry.npmjs.org/assert-plus
npm http GET https://registry.npmjs.org/asn1
npm http GET https://registry.npmjs.org/growl
npm http GET https://registry.npmjs.org/diff
npm http GET https://registry.npmjs.org/punycode
npm http GET https://registry.npmjs.org/cryptiles
npm http GET https://registry.npmjs.org/sntp
npm http GET https://registry.npmjs.org/hoek
npm http GET https://registry.npmjs.org/boom
npm http 304 https://registry.npmjs.org/ctype
npm http 304 https://registry.npmjs.org/asn1
npm http 304 https://registry.npmjs.org/assert-plus
npm http GET https://registry.npmjs.org/formatio
npm http GET https://registry.npmjs.org/util
npm http 304 https://registry.npmjs.org/diff
npm http 304 https://registry.npmjs.org/punycode
npm http 304 https://registry.npmjs.org/cryptiles
npm http 304 https://registry.npmjs.org/sntp
npm http 304 https://registry.npmjs.org/hoek
npm http 304 https://registry.npmjs.org/boom
npm http 304 https://registry.npmjs.org/formatio
npm http 304 https://registry.npmjs.org/util
npm http GET https://registry.npmjs.org/samsam
npm http 304 https://registry.npmjs.org/growl
npm http GET https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/samsam

[email protected] install /Users/leedorian/works/chetang.oschina/node_modules/email-templates/node_modules/node-sass
node build.js

module.js:340
throw err;
^
Error: Cannot find module 'mocha'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/leedorian/works/chetang.oschina/node_modules/email-templates/node_modules/node-sass/build.js:5:11)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 6
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls contextify
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 13.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/leedorian/works/chetang.oschina
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/leedorian/works/chetang.oschina/npm-debug.log
npm ERR! not ok code 0

parse html

parsing the template html can provide several benefits:

  1. validation. make sure I did not forget to close a tag.
  2. true css inlining. after template substitution and includes and extends, you can parse the html, grab the css, and use juice to inline it all.

final callback after batch is done

Hey,
is there a possibility to get a final callback after the batch is done?
I'm calling this as a module and would like to have a kind of interface, so I can handle the response.

Thanks
Tim

Error when text.ejs or style.css not exists

It's occured an error when we don't have text.ejs or style.css under the templates dir.

It's seems like that fs.stat will throw an error when the file is not exists. BTW, I am under os x lion and using node 0.6.18.

html template scope

In my use case I was sending two different emails with two different templates asynchronously (using Q.ninvoke) one after another. I found that no matter what I did the first email always took on the template of the second.

After looking at the source code, It appears the variable where the template is being stored is a bit higher in scope (currently main.js:35) than would be ideal of asynchronous use. In my case, the second call was overwriting the same variable before the other email got a chance to send.

Let me know if I need to clarify, wanted to leave a note before I forgot. Hope to send a pull request later.

Spawn ENOENT Error

I'm using windows 7 and I'm trying to install email-templates-windows and I'vet got an error with Spawn ENOENT

error [email protected] install: node-gyp rebuild
error cmd "/c" "node-gyp rebuild" failed with 1
error Failed at the [email protected] install script.
error This is most likely a problem with the contextify package,
error not with npm itself.
error Tell the author that this fails on your system:
error node-gyp rebuild
error You can get their info via:
error npm owner ls contextify
error There is likely additional logging output above.
error System Windows_NT 6.1.7601
error command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "email-templates-windows"
error cwd C:\Program Files\nodejs
error node -v v0.10.3
error npm -v 1.2.17
error code ELIFECYCLE

local variable containing html string?

I'm working on a system that uses templates, but allows the administrator to create "snippets" of messages that will be saved to their profile and inserted in the email template as a local variable.

The trouble I'm having is that the html that is to be inserted is being encoded, so <h1>Thank you {{ name }}</h1> is being sent to the template as &lt;h1&gt;Thank you {{ name }}&lt;/h1&gt;

Am I missing something? I've tried using modules such as html-entities to decode the locals contents before sending it to the template but am having 0 success.

The template would look something like this:

<%= greeting %> // <h1>Thank you {{ name }}</h1>
<p>Actual message</p>
<%= salutation %>

That is a pseudo example, the actual usage is more complicated and less difficult to solve by manually entering the greeting.

EJS Custom Filters?

Is it currently possible to add custom filters to node-email templates?

I looked over the code, and it doesn't seem like EJS custom filters are part of the EJS options that get passed into the render function.

Perhaps I'm missing something? Can I do filters in the options object? Sorry, I'm still learning EJS, this might be really obvious.

For the moment I've hacked in an additional 'filters' parameter to the node-email-templates' constructor which is merged into ejs.filters during construction. The only issue with this is that I have an empty options object, but it works.

Batch email documentation inconsistency

Hello,

First off thanks for creating this very useful module.

I noticed that the current documentation does not reflect a recent change to the render method's signature in this commit: @6055829c2a6b9f001b74f6b2a474d99905bd09e6

The current documentation in its example of a batch processing routine indicates that the render function inside the user defined Render function (passed at 'batch' here), should be called with:

  this.batch = function(batch) {
    batch(this.locals, this.send);
  };

Calling the render method this way results in an exception thrown by path.join, as path.join ends up receiving the callback in 'this.send' as an argument rather than the template path. I managed to get around this issue by invoking the render command like this:

  this.batch = function(batch) {
    batch(this.locals, myTemplatePathVar, this.send);
  };

template parameter is undefined

template parameter in emailTemplates(templatesDir, function(err, template) call comes as undefined so the later call to template() function gives an error.

Just copied and pasted from the example code.

Install template engines as peerDependencies?

One thing that jumped at me when doing npm install email-templates is that by default it lists as dependency every template engine that it supports.

I just wanted to ask if using peer dependencies could be a potential fix for this issue and if it has been considered.

I can send a pull request later today in case there's interest on exploring this option.

Error installing

I get the following error when installing through npm:

> [email protected] install /Users/jaakko/Projektit/DOF/palaveripalvelu/server/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild

  CXX(target) Release/obj.target/contextify/src/contextify.o
make: c++: No such file or directory
make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/node/0.10.24/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 13.0.2
gyp ERR! command "node" "/usr/local/Cellar/node/0.10.24/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jaakko/Projektit/DOF/palaveripalvelu/server/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok 
npm http 304 https://registry.npmjs.org/tunnel-agent
npm http 304 https://registry.npmjs.org/http-signature
npm http 304 https://registry.npmjs.org/aws-sign2
npm http 304 https://registry.npmjs.org/hawk
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/assert-plus/0.1.2
npm http GET https://registry.npmjs.org/asn1/0.1.11
npm http GET https://registry.npmjs.org/ctype/0.5.2
npm http GET https://registry.npmjs.org/punycode
npm http GET https://registry.npmjs.org/boom
npm http GET https://registry.npmjs.org/hoek
npm http GET https://registry.npmjs.org/sntp
npm http GET https://registry.npmjs.org/cryptiles
npm http 304 https://registry.npmjs.org/asn1/0.1.11
npm http 304 https://registry.npmjs.org/assert-plus/0.1.2
npm http 304 https://registry.npmjs.org/ctype/0.5.2
npm http 304 https://registry.npmjs.org/boom
npm http 304 https://registry.npmjs.org/cryptiles
npm http 304 https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/sntp
npm http 304 https://registry.npmjs.org/punycode
npm http 304 https://registry.npmjs.org/hoek
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls contextify
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 13.0.2
npm ERR! command "/usr/local/Cellar/node/0.10.24/bin/node" "/usr/local/bin/npm" "install" "email-templates" "--save"
npm ERR! cwd /Users/jaakko/Projektit/DOF/palaveripalvelu/server
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/jaakko/Projektit/DOF/palaveripalvelu/server/npm-debug.log
npm ERR! not ok code 0

Any ideas on how to fix this?

Feature request: Allow files to have the same name as the template

This is more of a feature request than an issue. It would be nice if we could use a naming convention which would prevent issues like this in my IDE:

image

I will be editing dozens of templates, and even dealing with 3 is already cumbersome. A naming convention like this would better suffice.

my-template

  • my-template-html.ejs
  • my-template-text.ejs
  • my-template-style.less

I don't mind implementing this and submitting a pull request if anybody else is interested. It wouldn't take much since glob supports regex. Let me know.

Empty email when stylesheet present

I can send an email using Jade without problems as long as no stylesheet is present. As soon as I put a stylesheet (style.css or style.less) in the template directory a call to template produces an empty html document:
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"></html>.

The stylesheet is not really spectacular, here it is in its full beauty:
body { background-color: white;}

I do not get any error. Any ideas how this can be debugged?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.