smtp-connection
Advanced tools
Comparing version 2.10.0 to 2.11.0
# Changelog | ||
## v2.11.0 2016-08-04 | ||
* Added new envelope option `size` to skip sending messages that are too large | ||
## v2.10.0 2016-07-22 | ||
@@ -4,0 +8,0 @@ |
@@ -133,2 +133,8 @@ 'use strict'; | ||
/** | ||
* Defines the maximum allowed size for a single message | ||
* @private | ||
*/ | ||
this._maxAllowedSize = 0; | ||
/** | ||
* Function queue to run if a data chunk comes from the server | ||
@@ -354,2 +360,9 @@ * @private | ||
// reject larger messages than allowed | ||
if (this._maxAllowedSize && envelope.size > this._maxAllowedSize) { | ||
return setImmediate(function () { | ||
done(this._formatError('Message size larger than allowed ' + this._maxAllowedSize, 'EMESSAGE', false, 'MAIL FROM')); | ||
}.bind(this)); | ||
} | ||
// ensure that callback is only called once | ||
@@ -765,2 +778,6 @@ var returned = false; | ||
if (this._envelope.size && this._supportedExtensions.indexOf('SIZE') >= 0) { | ||
args.push('SIZE=' + this._envelope.size); | ||
} | ||
// If the server supports DSN and the envelope includes an DSN prop | ||
@@ -916,2 +933,4 @@ // then append DSN params to the MAIL FROM command | ||
SMTPConnection.prototype._actionEHLO = function (str) { | ||
var match; | ||
if (str.substr(0, 3) === '421') { | ||
@@ -962,3 +981,3 @@ this._onError(new Error('Server terminates connection:\n' + str), 'ECONNECTION', str, 'EHLO'); | ||
// Detect if the server supports PLAIN auth | ||
if (str.match(/AUTH(?:(\s+|=)[^\n]*\s+|\s+|=)PLAIN/i)) { | ||
if (/AUTH(?:(\s+|=)[^\n]*\s+|\s+|=)PLAIN/i.test(str)) { | ||
this._supportedAuth.push('PLAIN'); | ||
@@ -968,3 +987,3 @@ } | ||
// Detect if the server supports LOGIN auth | ||
if (str.match(/AUTH(?:(\s+|=)[^\n]*\s+|\s+|=)LOGIN/i)) { | ||
if (/AUTH(?:(\s+|=)[^\n]*\s+|\s+|=)LOGIN/i.test(str)) { | ||
this._supportedAuth.push('LOGIN'); | ||
@@ -974,3 +993,3 @@ } | ||
// Detect if the server supports CRAM-MD5 auth | ||
if (str.match(/AUTH(?:(\s+|=)[^\n]*\s+|\s+|=)CRAM-MD5/i)) { | ||
if (/AUTH(?:(\s+|=)[^\n]*\s+|\s+|=)CRAM-MD5/i.test(str)) { | ||
this._supportedAuth.push('CRAM-MD5'); | ||
@@ -980,6 +999,12 @@ } | ||
// Detect if the server supports XOAUTH2 auth | ||
if (str.match(/AUTH(?:(\s+|=)[^\n]*\s+|\s+|=)XOAUTH2/i)) { | ||
if (/AUTH(?:(\s+|=)[^\n]*\s+|\s+|=)XOAUTH2/i.test(str)) { | ||
this._supportedAuth.push('XOAUTH2'); | ||
} | ||
// Detect if the server supports SIZE extensions (and the max allowed size) | ||
if ((match = str.match(/[ \-]SIZE(?:\s+(\d+))?/mi))) { | ||
this._supportedExtensions.push('SIZE'); | ||
this._maxAllowedSize = Number(match[1]) || 0; | ||
} | ||
this.emit('connect'); | ||
@@ -986,0 +1011,0 @@ }; |
{ | ||
"name": "smtp-connection", | ||
"version": "2.10.0", | ||
"version": "2.11.0", | ||
"description": "Connect to SMTP servers", | ||
@@ -31,7 +31,7 @@ "main": "lib/smtp-connection.js", | ||
"grunt-mocha-test": "^0.12.7", | ||
"mocha": "^2.5.3", | ||
"mocha": "^3.0.1", | ||
"proxy-test-server": "^1.0.0", | ||
"sinon": "^1.17.4", | ||
"smtp-server": "^1.11.2", | ||
"xoauth2": "^1.1.0" | ||
"sinon": "^1.17.5", | ||
"smtp-server": "^1.13.0", | ||
"xoauth2": "^1.2.0" | ||
}, | ||
@@ -38,0 +38,0 @@ "dependencies": { |
@@ -148,2 +148,3 @@ # smtp-connection | ||
- **envelope.to** is the recipient address or an array of addresses | ||
- **envelope.size** is an optional value of the predicted size of the message in bytes. This value is used if the server supports the SIZE extension (RFC1870) | ||
- **envelope.use8BitMime** if `true` then inform the server that this message might contain bytes outside 7bit ascii range | ||
@@ -150,0 +151,0 @@ - **envelope.dsn** is the dsn options |
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
66966
1410
201