Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

smtp-connection

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smtp-connection - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

5

CHANGELOG.md
# Changelog
## v1.1.0 2014-11-11
* Added additional constructor option `requireTLS` to ensure that the connection is upgraded before any credentials are passed to the server
* Added additional constructor option `socket` to use an existing socket instead of creating new one (bantu)
## v1.0.2 2014-10-15

@@ -4,0 +9,0 @@

2

package.json
{
"name": "smtp-connection",
"version": "1.0.2",
"version": "1.1.0",
"description": "Connect to SMTP servers",

@@ -5,0 +5,0 @@ "main": "src/smtp-connection.js",

@@ -30,2 +30,3 @@ # smtp-connection

* **options.ignoreTLS** turns off STARTTLS support if true
* **options.requireTLS** forces the client to use STARTTLS. Returns an error if upgrading the connection is not possible or fails.
* **options.name** optional hostname of the client, used for identifying to the server

@@ -37,4 +38,5 @@ * **options.localAddress** is the local interface to bind to for network connections

* **options.debug** if true, the connection emits all traffic between client and server as 'log' events
* **options.authMethod** defines preferred authentication method, eg. 'PLAIN'
* **options.tls** defines additional options to be passed to the socket constructor, eg. *{rejectUnauthorized: true}*
* **options.authMethod** defines preferred authentication method, e.g. 'PLAIN'
* **options.tls** defines additional options to be passed to the socket constructor, e.g. *{rejectUnauthorized: true}*
* **options.socket** - existing socket to use instead of creating a new one

@@ -76,3 +78,3 @@ ### Events

* **auth.xoauth2** is the OAuth2 access token (preferred if both `pass` and `xoauth2` values are set) or an [XOAuth2](https://github.com/andris9/xoauth2) token generator object.
* **callback** is the callback to run once the authentication is finished. Callback has the following arugments
* **callback** is the callback to run once the authentication is finished. Callback has the following arguments
* **err** and error object if authentication failed

@@ -118,3 +120,3 @@

* **message** is either a String, Buffer or a Stream. All newlines in converted to \r\n and all dots are escaped automatically, no need to convert anything before.
* **callback** is the callback to run once the sending is finished or failed. Callback has the following arugments
* **callback** is the callback to run once the sending is finished or failed. Callback has the following arguments
* **err** and error object if sending failed

@@ -125,3 +127,3 @@ * **code** string code identifying the error, for example 'EAUTH' is returned when authentication fails

* **info** information object about accepted and rejected recipients
* **acepted** and array of accepted recipient addresses
* **accepted** and array of accepted recipient addresses
* **rejected** and array of rejected recipient addresses

@@ -135,3 +137,3 @@ * **response** is the last response received from the server

```javascript
connection.quite();
connection.quit();
```

@@ -149,2 +151,2 @@

**MIT**
**MIT**

@@ -19,2 +19,4 @@ 'use strict';

*
* * **port** - is the port to connect to (defaults to 25 or 465)
* * **host** - is the hostname or IP address to connect to (defaults to 'localhost')
* * **secure** - use SSL

@@ -24,7 +26,10 @@ * * **name** - the name of the client server

* * **ignoreTLS** - ignore server support for STARTTLS
* * **tls** - options for createCredentials
* * **debug** - if true, emits 'log' events with all traffic between client and server
* * **requireTLS** - forces the client to use STARTTLS
* * **localAddress** - outbound address to bind to (see: http://nodejs.org/api/net.html#net_net_connect_options_connectionlistener)
* * **greetingTimeout** - Time to wait in ms until greeting message is received from the server (defaults to 10000)
* * **connectionTimeout** - how many milliseconds to wait for the connection to establish
* * **socketTimeout** - Time of inactivity until the connection is closed (defaults to 1 hour)
* * **debug** - if true, emits 'log' events with all traffic between client and server
* * **tls** - options for createCredentials
* * **socket** - existing socket to use instead of creating a new one (see: http://nodejs.org/api/net.html#net_class_net_socket)
*

@@ -138,2 +143,6 @@ * @constructor

SMTPConnection.prototype.connect = function(connectCallback) {
if (typeof connectCallback === 'function') {
this.once('connect', connectCallback);
}
var opts = {

@@ -144,6 +153,2 @@ port: this.options.port,

if (typeof connectCallback === 'function') {
this.once('connect', connectCallback);
}
if (this.options.localAddress) {

@@ -153,3 +158,6 @@ opts.localAddress = this.options.localAddress;

if (this.options.secure) {
if (this.options.socket) {
this._socket = this.options.socket;
this._socket.connect(this.options.port, this.options.host, this._onConnect.bind(this));
} else if (this.options.secure) {
if (this.options.tls) {

@@ -627,2 +635,7 @@ Object.keys(this.options.tls).forEach((function(key) {

if (str.charAt(0) !== '2') {
if (this.options.requireTLS) {
this._onError(new Error('EHLO failed but HELO does not support required STARTTLS:\n' + str), 'ECONNECTION', str);
return;
}
// Try HELO instead

@@ -635,3 +648,3 @@ this._currentAction = this._actionHELO;

// Detect if the server supports STARTTLS
if (!this._secureMode && str.match(/[ \-]STARTTLS\r?$/mi) && !this.options.ignoreTLS) {
if (!this._secureMode && !this.options.ignoreTLS && (/[ \-]STARTTLS\r?$/mi.test(str) || this.options.requireTLS)) {
this._sendCommand('STARTTLS');

@@ -638,0 +651,0 @@ this._currentAction = this._actionSTARTTLS;

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc