diff options
Diffstat (limited to 'tools/node_modules/nodemailer/lib/engines/stub.js')
-rw-r--r-- | tools/node_modules/nodemailer/lib/engines/stub.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tools/node_modules/nodemailer/lib/engines/stub.js b/tools/node_modules/nodemailer/lib/engines/stub.js new file mode 100644 index 0000000..754cc12 --- /dev/null +++ b/tools/node_modules/nodemailer/lib/engines/stub.js @@ -0,0 +1,39 @@ + +// Expose to the world +module.exports = StubTransport; + +/** + * <p>Generates a stub Transport object for testing purposes</p> + * + * @constructor + */ +function StubTransport(){} + +/** + * <p>Generates a raw e-mail source and returns it with callback</p> + * + * @param {Object} emailMessage MailComposer object + * @param {Function} callback Callback function to run when the e-mail is composed + */ +StubTransport.prototype.sendMail = function(emailMessage, callback) { + + var output = ""; + + // sendmail strips this header line by itself + emailMessage.options.keepBcc = true; + + emailMessage.on("data", function(data){ + output += (data || "").toString("utf-8"); + }); + + emailMessage.on("error", function(err){ + callback(err); + }); + + emailMessage.on("end", function(){ + callback(null, {message: output, envelope: emailMessage.getEnvelope()}); + }); + + emailMessage.streamMessage(); + +};
\ No newline at end of file |