Permalink
Browse files

bundle the callback associated with this specific message in with the…

… message itself, and call that once it can been sent.
  • Loading branch information...
1 parent 78537c7 commit c7a03f0ca78f99286c89266e346b61d44d51ca08 @smurthas committed Feb 14, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/node_mailer.js
View
3 lib/node_mailer.js
@@ -86,6 +86,7 @@ function merge(x,y) {
var pool = new SMTPClientPool();
exports.send = function node_mail(message, callback) {
+ message._callback = callback;
var server = {
host: message.host,
hostname: message.domain,
@@ -147,7 +148,7 @@ exports.send = function node_mail(message, callback) {
_templateCache[message.template].queue.push(message);
_templateCache[message.template].queue.forEach(function(msg, i){
msg.html = mustache.to_html(_templateCache[message.template].template, msg.data);
- dispatchMail(msg, server, callback);
+ dispatchMail(msg, server, msg._callback);
});
// Clear the queue out

0 comments on commit c7a03f0

Please sign in to comment.