smtp-server
Advanced tools
Comparing version 1.11.2 to 1.12.0
# Changelog | ||
## v1.12.0 2016-07-25 | ||
* Added new property for session: `session.transmissionType` that identifies the current transmission (SMTP, ESMTP, ESMTPA etc.) | ||
## v1.11.2 2016-07-15 | ||
@@ -4,0 +8,0 @@ |
@@ -108,2 +108,3 @@ 'use strict'; | ||
this.session.user = response.user; | ||
this.session.transmissionType = this._transmissionType(); | ||
@@ -166,2 +167,3 @@ this.send(235, 'Authentication successful'); | ||
this.session.user = response.user; | ||
this.session.transmissionType = this._transmissionType(); | ||
@@ -227,2 +229,3 @@ this.send(235, 'Authentication successful'); | ||
this.session.user = response.user; | ||
this.session.transmissionType = this._transmissionType(); | ||
@@ -275,2 +278,3 @@ this.send(235, 'Authentication successful'); | ||
this.session.user = response.user; | ||
this.session.transmissionType = this._transmissionType(); | ||
@@ -277,0 +281,0 @@ this.send(235, 'Authentication successful'); |
@@ -85,2 +85,5 @@ 'use strict'; | ||
// The opening SMTP command (HELO, EHLO or LHLO) | ||
this.openingCommand = false; | ||
// The hostname client identifies itself with | ||
@@ -317,2 +320,9 @@ this.hostNameAppearsAs = false; | ||
commandName = (command || '').toString().split(' ').shift().toUpperCase(); | ||
switch (commandName) { | ||
case 'HELO': | ||
case 'EHLO': | ||
case 'LHLO': | ||
this.openingCommand = commandName; | ||
break; | ||
} | ||
if (this._server.options.lmtp) { | ||
@@ -454,5 +464,7 @@ switch (commandName) { | ||
session.clientHostname = this.clientHostname; | ||
session.openingCommand = this.openingCommand; | ||
session.hostNameAppearsAs = this.hostNameAppearsAs; | ||
session.xClient = this._xClient; | ||
session.xForward = this._xForward; | ||
session.transmissionType = this._transmissionType(); | ||
@@ -468,2 +480,25 @@ // reset transaction properties | ||
/** | ||
* Returns current transmission type | ||
* | ||
* @return {String} Transmission type | ||
*/ | ||
SMTPConnection.prototype._transmissionType = function () { | ||
var type = this._server.options.lmtp ? 'LMTP' : 'SMTP'; | ||
if (this.openingCommand === 'EHLO') { | ||
type = 'E' + type; | ||
} | ||
if (this.secure) { | ||
type += 'S'; | ||
} | ||
if (this.session.user) { | ||
type += 'A'; | ||
} | ||
return type; | ||
}; | ||
// COMMAND HANDLERS | ||
@@ -470,0 +505,0 @@ |
{ | ||
"name": "smtp-server", | ||
"version": "1.11.2", | ||
"version": "1.12.0", | ||
"description": "Create custom SMTP servers on the fly", | ||
@@ -22,3 +22,3 @@ "main": "lib/smtp-server.js", | ||
"mocha": "^2.5.3", | ||
"smtp-connection": "^2.7.0" | ||
"smtp-connection": "^2.10.0" | ||
}, | ||
@@ -25,0 +25,0 @@ "engines": { |
@@ -385,2 +385,3 @@ # smtp-server | ||
* **clientHostname** reverse resolved hostname for *remoteAddress* | ||
* **openingCommand** the opening SMTP command (HELO/EHLO/LHLO) | ||
* **hostNameAppearsAs** hostname the client provided with HELO/EHLO call | ||
@@ -392,2 +393,3 @@ * **envelope** includes denvelope data | ||
* **transaction** number of the current transaction. 1 is for the first message, 2 is for the 2nd message etc. | ||
* **transmissionType** indicates the current protocol type for the received header (SMTP, ESMTP, ESMTPA etc.) | ||
@@ -394,0 +396,0 @@ ## Address object |
@@ -54,3 +54,3 @@ /* eslint no-unused-expressions:0 */ | ||
datastream.on('end', function () { | ||
expect(output).to.equal('test1\r\n.test2\r\n.test3'); | ||
expect(output).to.equal('test1\r\n.test2\r\n.test3\r\n'); | ||
stream.continue(); | ||
@@ -57,0 +57,0 @@ }); |
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
140701
2968
461