smtp-connection
Advanced tools
Comparing version 2.0.0-beta.4 to 2.0.0-beta.5
# Changelog | ||
## v2.0.0-beta.5 2016-01-03 | ||
* Fixed a bug where errors might been thrown before a handler was set | ||
## v2.0.0-beta.3 2016-01-03 | ||
@@ -4,0 +8,0 @@ |
@@ -282,7 +282,24 @@ 'use strict'; | ||
*/ | ||
SMTPConnection.prototype.send = function (envelope, message, callback) { | ||
SMTPConnection.prototype.send = function (envelope, message, done) { | ||
if (!message) { | ||
return callback(this._formatError('Empty message', 'EMESSAGE')); | ||
return done(this._formatError('Empty message', 'EMESSAGE')); | ||
} | ||
// ensure that callback is only called once | ||
var returned = false; | ||
var callback = function () { | ||
if (returned) { | ||
return; | ||
} | ||
returned = true; | ||
done.apply(null, Array.prototype.slice.call(arguments)); | ||
}; | ||
if (typeof message.on === 'function') { | ||
message.on('error', function (err) { | ||
return callback(this._formatError(err, 'ESTREAM')); | ||
}.bind(this)); | ||
} | ||
this._setEnvelope(envelope, function (err, info) { | ||
@@ -301,5 +318,2 @@ if (err) { | ||
message.pipe(stream); | ||
message.on('error', function (err) { | ||
return callback(err); | ||
}); | ||
} else { | ||
@@ -306,0 +320,0 @@ stream.write(message); |
{ | ||
"name": "smtp-connection", | ||
"version": "2.0.0-beta.4", | ||
"version": "2.0.0-beta.5", | ||
"description": "Connect to SMTP servers", | ||
@@ -5,0 +5,0 @@ "main": "lib/smtp-connection.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48346
1072