From c7a03f0ca78f99286c89266e346b61d44d51ca08 Mon Sep 17 00:00:00 2001 From: Simon Murtha-Smith Date: Tue, 14 Feb 2012 15:17:50 -0800 Subject: [PATCH] bundle the callback associated with this specific message in with the message itself, and call that once it can been sent. --- lib/node_mailer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/node_mailer.js b/lib/node_mailer.js index e1ccb43..0d9c503 100644 --- a/lib/node_mailer.js +++ b/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