Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Deliveries array for testing purpose #38

Open
wants to merge 3 commits into from

2 participants

@pacovell

Re: Issue #18. If test is truthy, message will be added to the deliveries export for inspection and will not be sent.

@Marak
Owner

Cool, I will review and bump in the next few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 4, 2011
  1. @pacovell

    If test is truthy, message will be added to the deliveries export for…

    pacovell authored
    … inspection and will not be sent
Commits on Aug 17, 2011
  1. @pacovell
  2. @pacovell
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 4 deletions.
  1. +13 −3 lib/node_mailer.js
  2. +1 −1  package.json
View
16 lib/node_mailer.js
@@ -27,6 +27,7 @@ var EmailMessage = require("nodemailer").EmailMessage;
var fs = require('fs');
var mustache = require('../vendor/mustache');
var _templateCache = {};
+var deliveries = exports.deliveries = [];
function SMTPClientPool() {
this.servers = {};
@@ -68,8 +69,16 @@ SMTPClientPool.prototype.send = function send(message, callback) {
delete hostClients[options.user];
client.close();})
}
- client.sendMail(message,callback);
- client.on('error', callback);
+ if(message.SERVER.test) {
+ deliveries.push(message);
+ if(message.debug) {
+ console.log("Node mailer added message: " + require('sys').inspect(message));
+ }
+ }
+ else {
+ client.sendMail(message,callback);
+ client.on('error', callback);
+ }
}
function merge(x,y) {
@@ -94,7 +103,8 @@ exports.send = function node_mail(message, callback) {
ssl: message.ssl,
user: message.username && message.username.toString(),
pass: message.password && message.password.toString(),
- debug: true
+ test: message.test,
+ debug: message.debug
};
if(message.username || message.password) {
pool.addClient(server.port, server.host, server);
View
2  package.json
@@ -13,7 +13,7 @@
"url": "http://github.com/Marak/node_mailer.git"
},
"dependencies": {
- "nodemailer": ">= 0.1.10",
+ "nodemailer": "0.1.x",
"colors": ">= 0.3.0"
},
"engine": [ "node >=0.3.0" ],
Something went wrong with that request. Please try again.