forked from nodemailer/nodemailer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andris Reinman
committed
Mar 27, 2012
1 parent
9fdff73
commit 2b9a3c9
Showing
6 changed files
with
85 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}); | ||
}); | ||
|
||
emailMessage.streamMessage(); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters