smtp-connection
Advanced tools
Comparing version 2.0.0-beta.0 to 2.0.0-beta.1
# Changelog | ||
## v2.0.0-beta.1 2016-01-01 | ||
* Re-added `debug` option. If set to true, then logs SMTP traffic, otherwise only transaction events | ||
* Pass streamed message content to the logger | ||
## v2.0.0-beta.0 2016-01-01 | ||
@@ -4,0 +9,0 @@ |
@@ -11,2 +11,3 @@ 'use strict'; | ||
var DataStream = require('./data-stream'); | ||
var PassThrough = require('stream').PassThrough; | ||
@@ -32,2 +33,3 @@ module.exports = SMTPConnection; | ||
* * **logger** - bunyan compatible logger interface | ||
* * **debug** - if true pass SMTP traffic to the logger | ||
* * **tls** - options for createCredentials | ||
@@ -530,3 +532,5 @@ * * **socket** - existing socket to use instead of creating a new one (see: http://nodejs.org/api/net.html#net_class_net_socket) | ||
this.logger.debug('S: %s', str.trim()); | ||
if (this.options.debug) { | ||
this.logger.debug('S: %s', str.trim()); | ||
} | ||
@@ -563,3 +567,5 @@ if (!str.trim()) { // skip unexpected empty lines | ||
this.logger.debug('C: %s', (str || '').toString().trim()); | ||
if (this.options.debug) { | ||
this.logger.debug('C: %s', (str || '').toString().trim()); | ||
} | ||
@@ -613,2 +619,3 @@ this._socket.write(new Buffer(str + '\r\n', 'utf-8')); | ||
var dataStream = new DataStream(); | ||
var logStream; | ||
@@ -623,8 +630,12 @@ this._currentAction = function (str) { | ||
dataStream.on('readable', function () { | ||
var chunk; | ||
while ((chunk = dataStream.read())) { | ||
this.logger.debug('C: %s', chunk.toString('binary').trim()); | ||
} | ||
}.bind(this)); | ||
if (this.options.debug) { | ||
logStream = new PassThrough(); | ||
logStream.on('readable', function () { | ||
var chunk; | ||
while ((chunk = logStream.read())) { | ||
this.logger.debug('C: %s', chunk.toString('binary').trim()); | ||
} | ||
}.bind(this)); | ||
dataStream.pipe(logStream); | ||
} | ||
@@ -631,0 +642,0 @@ return dataStream; |
{ | ||
"name": "smtp-connection", | ||
"version": "2.0.0-beta.0", | ||
"version": "2.0.0-beta.1", | ||
"description": "Connect to SMTP servers", | ||
@@ -5,0 +5,0 @@ "main": "lib/smtp-connection.js", |
@@ -40,2 +40,3 @@ # smtp-connection | ||
* **options.logger** optional [bunyan](https://github.com/trentm/node-bunyan) compatible logger instance. By default logs to console. If set to `false` then nothing is logged | ||
* **options.debug** if set to true, then log SMTP traffic, otherwise log only transaction events | ||
* **options.lmtp** if true, uses LMTP instead of SMTP to talk to the server. Partial support, does not work well with multiple recipients | ||
@@ -42,0 +43,0 @@ * **options.authMethod** defines preferred authentication method, e.g. 'PLAIN' |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
47933
1078
154
2