smtp-connection
Advanced tools
Comparing version 1.1.0 to 1.2.0
# Changelog | ||
## v1.2.0 2015-03-09 | ||
* Connection object has a new property `secure` that indicates if the current connection is using a secure TLS socket or not | ||
* Fixed `requireTLS` where the connection was established insecurely if STARTTLS failed, now it returns an error as it should if STARTTLS fails | ||
## v1.1.0 2014-11-11 | ||
@@ -4,0 +9,0 @@ |
@@ -0,3 +1,4 @@ | ||
'use strict'; | ||
module.exports = function(grunt) { | ||
'use strict'; | ||
@@ -4,0 +5,0 @@ // Project configuration. |
{ | ||
"name": "smtp-connection", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Connect to SMTP servers", | ||
@@ -26,11 +26,11 @@ "main": "src/smtp-connection.js", | ||
"devDependencies": { | ||
"chai": "^1.9.2", | ||
"chai": "^2.1.1", | ||
"grunt": "^0.4.5", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-mocha-test": "^0.12.1", | ||
"mocha": "^1.21.5", | ||
"simplesmtp": "^0.3.33", | ||
"sinon": "^1.10.3", | ||
"grunt-contrib-jshint": "^0.11.0", | ||
"grunt-mocha-test": "^0.12.7", | ||
"mocha": "^2.2.1", | ||
"smtp-server": "^1.0.2", | ||
"sinon": "^1.13.0", | ||
"xoauth2": "^1.0.0" | ||
} | ||
} |
# smtp-connection | ||
Connect to SMTP servers | ||
SMTP client module. Connect to SMTP servers and send mail with it. | ||
This is a fork of [simplesmtp](https://github.com/andris9/simplesmtp). Includes only the client and nothing more. API is simplified and should be easier to use. | ||
This module is the successor for the client part of the (now deprecated) SMTP module [simplesmtp](https://www.npmjs.com/package/simplesmtp). For matching SMTP server see [smtp-server](https://www.npmjs.com/package/smtp-server). | ||
[![Build Status](https://secure.travis-ci.org/andris9/smtp-connection.svg)](http://travis-ci.org/andris9/Nodemailer) | ||
[![npm version](https://badge.fury.io/js/smtp-connection.svg)](http://badge.fury.io/js/smtp-connection) | ||
## Usage | ||
@@ -62,2 +65,6 @@ | ||
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 | ||
### login | ||
@@ -117,3 +124,3 @@ | ||
* **envelope.to** is the recipient address or an array of addresses | ||
* **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. | ||
* **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 | ||
@@ -120,0 +127,0 @@ * **err** and error object if sending failed |
@@ -22,6 +22,5 @@ 'use strict'; | ||
* * **secure** - use SSL | ||
* * **name** - the name of the client server | ||
* * **auth** - authentication object {user:'...', pass:'...'} | ||
* * **ignoreTLS** - ignore server support for STARTTLS | ||
* * **requireTLS** - forces the client to use STARTTLS | ||
* * **name** - the name of the client server | ||
* * **localAddress** - outbound address to bind to (see: http://nodejs.org/api/net.html#net_net_connect_options_connectionlistener) | ||
@@ -75,3 +74,3 @@ * * **greetingTimeout** - Time to wait in ms until greeting message is received from the server (defaults to 10000) | ||
*/ | ||
this._secureMode = false; | ||
this.secure = false; | ||
@@ -133,3 +132,3 @@ /** | ||
if (this.options.secure) { | ||
this._secureMode = true; | ||
this.secure = true; | ||
} | ||
@@ -474,3 +473,3 @@ } | ||
this._ignoreData = false; | ||
this._secureMode = true; | ||
this.secure = true; | ||
this._socket.on('data', this._onData.bind(this)); | ||
@@ -646,3 +645,3 @@ | ||
// Detect if the server supports STARTTLS | ||
if (!this._secureMode && !this.options.ignoreTLS && (/[ \-]STARTTLS\r?$/mi.test(str) || this.options.requireTLS)) { | ||
if (!this.secure && !this.options.ignoreTLS && (/[ \-]STARTTLS\r?$/mi.test(str) || this.options.requireTLS)) { | ||
this._sendCommand('STARTTLS'); | ||
@@ -700,5 +699,3 @@ this._currentAction = this._actionSTARTTLS; | ||
if (str.charAt(0) !== '2') { | ||
// Try HELO instead | ||
this._currentAction = this._actionHELO; | ||
this._sendCommand('HELO ' + this.options.name); | ||
this._onError(new Error('Error upgrading connection with STARTTLS', 'ETLS', str)); | ||
return; | ||
@@ -705,0 +702,0 @@ } |
Sorry, the diff of this file is not supported yet
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
41355
153
946