nodemailer
Advanced tools
Comparing version 5.0.1 to 5.1.0
# CHANGELOG | ||
## 5.1.0 2019-01-09 | ||
- Official support for custom authentication methods and examples (examples/custom-auth-async.js and examples/custom-auth-cb.js) | ||
## 5.0.1 2019-01-09 | ||
@@ -4,0 +8,0 @@ |
@@ -139,3 +139,3 @@ 'use strict'; | ||
if (!callback && typeof Promise === 'function') { | ||
if (!callback) { | ||
promise = new Promise((resolve, reject) => { | ||
@@ -142,0 +142,0 @@ callback = shared.callbackPromise(resolve, reject); |
@@ -397,3 +397,3 @@ /* eslint no-undefined: 0, prefer-spread: 0, no-control-regex: 0 */ | ||
if (!callback && typeof Promise === 'function') { | ||
if (!callback) { | ||
promise = new Promise((resolve, reject) => { | ||
@@ -400,0 +400,0 @@ callback = shared.callbackPromise(resolve, reject); |
@@ -71,3 +71,3 @@ 'use strict'; | ||
if (!callback && typeof Promise === 'function') { | ||
if (!callback) { | ||
promise = new Promise((resolve, reject) => { | ||
@@ -74,0 +74,0 @@ callback = shared.callbackPromise(resolve, reject); |
@@ -285,3 +285,3 @@ 'use strict'; | ||
if (!callback && typeof Promise === 'function') { | ||
if (!callback) { | ||
promise = new Promise((resolve, reject) => { | ||
@@ -288,0 +288,0 @@ callback = shared.callbackPromise(resolve, reject); |
@@ -302,3 +302,3 @@ /* eslint no-console: 0 */ | ||
if (!callback && typeof Promise === 'function') { | ||
if (!callback) { | ||
promise = new Promise((resolve, reject) => { | ||
@@ -305,0 +305,0 @@ callback = module.exports.callbackPromise(resolve, reject); |
@@ -451,7 +451,48 @@ 'use strict'; | ||
let lastResponse; | ||
handler({ | ||
let returned = false; | ||
let resolve = () => { | ||
if (returned) { | ||
return; | ||
} | ||
returned = true; | ||
this.logger.info( | ||
{ | ||
tnx: 'smtp', | ||
username: this._auth.user, | ||
action: 'authenticated', | ||
method: this._authMethod | ||
}, | ||
'User %s authenticated', | ||
JSON.stringify(this._auth.user) | ||
); | ||
this.authenticated = true; | ||
callback(null, true); | ||
}; | ||
let reject = err => { | ||
if (returned) { | ||
return; | ||
} | ||
returned = true; | ||
callback(this._formatError(err, 'EAUTH', lastResponse, 'AUTH ' + this._authMethod)); | ||
}; | ||
let handlerResponse = handler({ | ||
auth: this._auth, | ||
method: this._authMethod, | ||
extensions: [].concat(this._supportedExtensions), | ||
authMethods: [].concat(this._supportedAuth), | ||
maxAllowedSize: this._maxAllowedSize || false, | ||
sendCommand: (cmd, done) => { | ||
let promise; | ||
if (!done) { | ||
promise = new Promise((resolve, reject) => { | ||
done = shared.callbackPromise(resolve, reject); | ||
}); | ||
} | ||
this._responseActions.push(str => { | ||
@@ -462,35 +503,31 @@ lastResponse = str; | ||
let data = { | ||
command: cmd | ||
command: cmd, | ||
response: str | ||
}; | ||
if (codes) { | ||
data.status = Number(codes[1]); | ||
data.status = Number(codes[1]) || 0; | ||
if (codes[2]) { | ||
data.code = codes[2]; | ||
} | ||
data.response = str.substr(codes[0].length); | ||
data.text = str.substr(codes[0].length); | ||
} else { | ||
data.response = str; | ||
data.text = str; | ||
data.status = 0; // just in case we need to perform numeric comparisons | ||
} | ||
done(null, data); | ||
}); | ||
this._sendCommand(cmd); | ||
}, | ||
setImmediate(() => this._sendCommand(cmd)); | ||
resolve: () => { | ||
this.logger.info( | ||
{ | ||
tnx: 'smtp', | ||
username: this._auth.user, | ||
action: 'authenticated', | ||
method: this._authMethod | ||
}, | ||
'User %s authenticated', | ||
JSON.stringify(this._auth.user) | ||
); | ||
this.authenticated = true; | ||
callback(null, true); | ||
return promise; | ||
}, | ||
reject: err => callback(this._formatError(err, 'EAUTH', lastResponse, 'AUTH ' + this._authMethod)) | ||
resolve, | ||
reject | ||
}); | ||
if (handlerResponse && typeof handlerResponse.catch === 'function') { | ||
// a promise was returned | ||
handlerResponse.then(resolve).catch(reject); | ||
} | ||
return; | ||
@@ -497,0 +534,0 @@ } |
@@ -505,3 +505,3 @@ 'use strict'; | ||
if (!callback && typeof Promise === 'function') { | ||
if (!callback) { | ||
promise = new Promise((resolve, reject) => { | ||
@@ -508,0 +508,0 @@ callback = shared.callbackPromise(resolve, reject); |
@@ -301,3 +301,3 @@ 'use strict'; | ||
if (!callback && typeof Promise === 'function') { | ||
if (!callback) { | ||
promise = new Promise((resolve, reject) => { | ||
@@ -304,0 +304,0 @@ callback = shared.callbackPromise(resolve, reject); |
{ | ||
"name": "nodemailer", | ||
"version": "5.0.1", | ||
"version": "5.1.0", | ||
"description": "Easy as cake e-mail sending from your Node.js applications", | ||
@@ -5,0 +5,0 @@ "main": "lib/nodemailer.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
459509
11256