diff --git a/lib/connectors/mail.js b/lib/connectors/mail.js index cd9df7b8..1e9b346a 100644 --- a/lib/connectors/mail.js +++ b/lib/connectors/mail.js @@ -58,7 +58,12 @@ MailConnector.prototype.setupTransport = function(setting) { var connector = this; connector.transports = connector.transports || []; connector.transportsIndex = connector.transportsIndex || {}; - var transport = mailer.createTransport(setting.type, setting); + + var transportModuleName = 'nodemailer-' + (setting.type || 'STUB').toLowerCase() + '-transport'; + var transportModule = require(transportModuleName); + + var transport = mailer.createTransport(transportModule(setting)); + connector.transportsIndex[setting.type] = transport; connector.transports.push(transport); } diff --git a/package.json b/package.json index f7496020..1e337f72 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,8 @@ "bcryptjs": "~2.0.1", "debug": "~1.0.4", "inflection": "~1.3.8", - "nodemailer": "~0.7.1", + "nodemailer": "~1.0.1", + "nodemailer-stub-transport": "~0.1.4", "uid2": "0.0.3", "underscore": "~1.6.0", "underscore.string": "~2.3.3" diff --git a/test/email.test.js b/test/email.test.js index 9a23ecb8..325330a0 100644 --- a/test/email.test.js +++ b/test/email.test.js @@ -24,7 +24,8 @@ describe('Email and SMTP', function () { }; MyEmail.send(options, function(err, mail) { - assert(mail.message); + assert(!err); + assert(mail.response); assert(mail.envelope); assert(mail.messageId); done(err); @@ -41,7 +42,7 @@ describe('Email and SMTP', function () { }); message.send(function (err, mail) { - assert(mail.message); + assert(mail.response); assert(mail.envelope); assert(mail.messageId); done(err); diff --git a/test/user.test.js b/test/user.test.js index 8b2e7b92..047ff831 100644 --- a/test/user.test.js +++ b/test/user.test.js @@ -443,11 +443,11 @@ describe('User', function(){ user.verify(options, function (err, result) { assert(result.email); - assert(result.email.message); + assert(result.email.response); assert(result.token); - assert(~result.email.message.indexOf('To: bar@bat.com')); + assert(~result.email.response.toString('utf-8').indexOf('To: bar@bat.com')); done(); }); });