Socket
Socket
Sign inDemoInstall

nodemailer-smtp-pool

Package Overview
Dependencies
5
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.2.1 to 2.3.0

76

lib/smtp-pool.js

@@ -390,1 +390,77 @@ 'use strict';

};
/**
* Verifies SMTP configuration
*
* @param {Function} callback Callback function
*/
SMTPPool.prototype.verify = function (callback) {
this.getSocket(this.options, function (err, socketOptions) {
if (err) {
return callback(err);
}
var options = this.options;
if (socketOptions && socketOptions.connection) {
this.logger.info('Using proxied socket from %s:%s', socketOptions.connection.remoteAddress, socketOptions.connection.remotePort);
options = clone(options);
Object.keys(socketOptions).forEach(function (key) {
options[key] = socketOptions[key];
});
}
var connection = new SMTPConnection(options);
var returned = false;
connection.once('error', function (err) {
if (returned) {
return;
}
returned = true;
connection.close();
return callback(err);
});
connection.once('end', function () {
if (returned) {
return;
}
returned = true;
return callback(new Error('Connection closed'));
});
var finalize = function () {
if (returned) {
return;
}
returned = true;
connection.quit();
return callback(null, true);
};
connection.connect(function () {
if (returned) {
return;
}
if (this.options.auth) {
connection.login(this.options.auth, function (err) {
if (returned) {
return;
}
if (err) {
returned = true;
connection.close();
return callback(err);
}
finalize();
});
} else {
finalize();
}
}.bind(this));
}.bind(this));
};

6

package.json
{
"name": "nodemailer-smtp-pool",
"version": "2.2.1",
"version": "2.3.0",
"description": "SMTP transport for Nodemailer",

@@ -27,3 +27,3 @@ "main": "lib/smtp-pool.js",

"nodemailer-wellknown": "0.1.7",
"smtp-connection": "2.2.2"
"smtp-connection": "2.2.4"
},

@@ -33,3 +33,3 @@ "devDependencies": {

"grunt": "^0.4.5",
"grunt-eslint": "^17.3.1",
"grunt-eslint": "^17.3.2",
"grunt-mocha-test": "^0.12.7",

@@ -36,0 +36,0 @@ "mocha": "^2.4.5",

@@ -167,4 +167,19 @@ # SMTP transport module for Nodemailer

## Verify connection configuration
You can verify your configuration with `verify(callback)` call. If it returns an error, then something is not correct, otherwise the server is ready to accept messages.
```javascript
// verify connection configuration
transporter.verify(function(error, success) {
if (error) {
console.log(error);
} else {
console.log('Server is ready to take our messages');
}
});
```
## License
**MIT**
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc