Socket
Socket
Sign inDemoInstall

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 2.9.0 to 2.10.0

4

CHANGELOG.md
# Changelog
## v2.10.0 2016-07-22
* Added new option `opportunisticTLS` to allow continuing if STARTTLS failed
## v2.9.0 2016-07-13

@@ -4,0 +8,0 @@

@@ -1004,2 +1004,6 @@ 'use strict';

if (str.charAt(0) !== '2') {
if (this.options.opportunisticTLS) {
this.logger.info('[%s] Failed STARTTLS upgrade, continuing unencrypted', this.id);
return this.emit('connect');
}
this._onError(new Error('Error upgrading connection with STARTTLS'), 'ETLS', str, 'STARTTLS');

@@ -1006,0 +1010,0 @@ return;

4

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

@@ -34,3 +34,3 @@ "main": "lib/smtp-connection.js",

"sinon": "^1.17.4",
"smtp-server": "^1.11.1",
"smtp-server": "^1.11.2",
"xoauth2": "^1.1.0"

@@ -37,0 +37,0 @@ },

@@ -7,4 +7,3 @@ # smtp-connection

[![Build Status](https://secure.travis-ci.org/nodemailer/smtp-connection.svg)](http://travis-ci.org/nodemailer/smtp-connection)
[![npm version](https://badge.fury.io/js/smtp-connection.svg)](http://badge.fury.io/js/smtp-connection)
[![Build Status](https://secure.travis-ci.org/nodemailer/smtp-connection.svg)](http://travis-ci.org/nodemailer/smtp-connection) [![npm version](https://badge.fury.io/js/smtp-connection.svg)](http://badge.fury.io/js/smtp-connection)

@@ -15,7 +14,11 @@ ## Usage

npm install smtp-connection
```
npm install smtp-connection
```
Require in your script
var SMTPConnection = require('smtp-connection');
```
var SMTPConnection = require('smtp-connection');
```

@@ -30,20 +33,21 @@ ### Create SMTPConnection instance

* **options** defines connection data
* **options.port** is the port to connect to (defaults to 25 or 465)
* **options.host** is the hostname or IP address to connect to (defaults to 'localhost')
* **options.secure** defines if the connection should use SSL (if `true`) or not (if `false`)
* **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** defines connection data
* **options.name** optional hostname of the client, used for identifying to the server
* **options.localAddress** is the local interface to bind to for network connections
* **options.connectionTimeout** how many milliseconds to wait for the connection to establish
* **options.greetingTimeout** how many milliseconds to wait for the greeting after connection is established
* **options.socketTimeout** how many milliseconds of inactivity to allow
* **options.logger** optional [bunyan](https://github.com/trentm/node-bunyan) compatible logger instance. If set to `true` then logs to console. If value is not set or is `false` then nothing is logged
* **options.debug** if set to true, then logs SMTP traffic, otherwise logs only transaction events
* **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** - initialized socket to use instead of creating a new one
* **options.connection** - connected socket to use instead of creating and connecting a new one. If `secure` option is true, then socket is upgraded from plaintext to ciphertext
- **options.port** is the port to connect to (defaults to 25 or 465)
- **options.host** is the hostname or IP address to connect to (defaults to 'localhost')
- **options.secure** defines if the connection should use SSL (if `true`) or not (if `false`)
- **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.opportunisticTLS** tries to use STARTTLS and continues normally if it fails
- **options.name** optional hostname of the client, used for identifying to the server
- **options.localAddress** is the local interface to bind to for network connections
- **options.connectionTimeout** how many milliseconds to wait for the connection to establish
- **options.greetingTimeout** how many milliseconds to wait for the greeting after connection is established
- **options.socketTimeout** how many milliseconds of inactivity to allow
- **options.logger** optional [bunyan](https://github.com/trentm/node-bunyan) compatible logger instance. If set to `true` then logs to console. If value is not set or is `false` then nothing is logged
- **options.debug** if set to true, then logs SMTP traffic, otherwise logs only transaction events
- **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** - initialized socket to use instead of creating a new one
- **options.connection** - connected socket to use instead of creating and connecting a new one. If `secure` option is true, then socket is upgraded from plaintext to ciphertext

@@ -54,5 +58,5 @@ ### Events

* **'error'** *(err)* emitted when an error occurs. Connection is closed automatically in this case.
* **'connect'** emitted when the connection is established
* **'end'** when the instance is destroyed
- **'error'** _(err)_ emitted when an error occurs. Connection is closed automatically in this case.
- **'connect'** emitted when the connection is established
- **'end'** when the instance is destroyed

@@ -69,7 +73,7 @@ ### connect

* **callback** is the function to run once the connection is established. The function is added as a listener to the 'connect' event.
- **callback** is the function to run once the connection is established. The function is added as a listener to the 'connect' event.
After the connect event the `connection` has the following properties:
* **connection.secure** - if `true` then the connection uses a TLS socket, otherwise it is using a cleartext socket. Connection can start out as cleartext but if available (or `requireTLS` is set to true) connection upgrade is tried
- **connection.secure** - if `true` then the connection uses a TLS socket, otherwise it is using a cleartext socket. Connection can start out as cleartext but if available (or `requireTLS` is set to true) connection upgrade is tried

@@ -86,9 +90,12 @@ ### login

* **auth** is the authentication object
* **auth.user** is the username
* **auth.pass** is the password for the user
* **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 arguments
* **err** and error object if authentication failed
- **auth** is the authentication object
- **auth.user** is the username
- **auth.pass** is the password for the user
- **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 arguments
- **err** and error object if authentication failed
If a [XOAuth2](https://github.com/andris9/xoauth2) token generator is used as the value for `auth.xoauth2` then you do not need to set `auth.user`. XOAuth2 generator generates required accessToken itself if it is missing or expired. In this case if the authentication fails, a new token is requeested and the authentication is retried. If it still fails, an error is returned.

@@ -131,4 +138,3 @@

I do not have access to an actual server that supports NTLM authentication
so this feature is untested and should be used carefully.
I do not have access to an actual server that supports NTLM authentication so this feature is untested and should be used carefully.

@@ -145,23 +151,31 @@ ### send

* **envelope** is the envelope object to use
* **envelope.from** is the sender address
* **envelope.to** is the recipient address or an array of addresses
* **envelope.use8BitMime** if `true` then inform the server that this message might contain bytes outside 7bit ascii range
* **envelope.dsn** is the dsn options
* **envelope.dsn.ret** return either the full message 'FULL' or only headers 'HDRS'
* **envelope.dsn.envid** sender's 'envelope identifier' for tracking
* **envelope.dsn.notify** when to send a DSN. Multiple options are OK - array or comma delimited. NEVER must appear by itself. Available options: 'NEVER', 'SUCCESS', 'FAILURE', 'DELAY'
* **envelope.dsn.orcpt** original recipient
* **message** is either a String, Buffer or a Stream. All newlines are 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 arguments
* **err** and error object if sending failed
* **code** string code identifying the error, for example 'EAUTH' is returned when authentication fails
* **response** is the last response received from the server (if the error is caused by an error response from the server)
* **responseCode** is the numeric response code of the `response` string (if available)
* **info** information object about accepted and rejected recipients
* **accepted** an array of accepted recipient addresses. Normally this array should contain at least one address except when in LMTP mode. In this case the message itself might have succeeded but all recipients were rejected after sending the message.
* **rejected** an array of rejected recipient addresses. This array includes both the addresses that were rejected before sending the message and addresses rejected after sending it if using LMTP
* **rejectedErrors** if some recipients were rejected then this property holds an array of error objects for the rejected recipients
* **response** is the last response received from the server
- **envelope** is the envelope object to use
- **envelope.from** is the sender address
- **envelope.to** is the recipient address or an array of addresses
- **envelope.use8BitMime** if `true` then inform the server that this message might contain bytes outside 7bit ascii range
- **envelope.dsn** is the dsn options
- **envelope.dsn.ret** return either the full message 'FULL' or only headers 'HDRS'
- **envelope.dsn.envid** sender's 'envelope identifier' for tracking
- **envelope.dsn.notify** when to send a DSN. Multiple options are OK - array or comma delimited. NEVER must appear by itself. Available options: 'NEVER', 'SUCCESS', 'FAILURE', 'DELAY'
- **envelope.dsn.orcpt** original recipient
- **message** is either a String, Buffer or a Stream. All newlines are 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 arguments
- **err** and error object if sending failed
- **code** string code identifying the error, for example 'EAUTH' is returned when authentication fails
- **response** is the last response received from the server (if the error is caused by an error response from the server)
- **responseCode** is the numeric response code of the `response` string (if available)
- **info** information object about accepted and rejected recipients
- **accepted** an array of accepted recipient addresses. Normally this array should contain at least one address except when in LMTP mode. In this case the message itself might have succeeded but all recipients were rejected after sending the message.
- **rejected** an array of rejected recipient addresses. This array includes both the addresses that were rejected before sending the message and addresses rejected after sending it if using LMTP
- **rejectedErrors** if some recipients were rejected then this property holds an array of error objects for the rejected recipients
- **response** is the last response received from the server
### quit

@@ -168,0 +182,0 @@

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