New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

smtp-channel

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smtp-channel - npm Package Compare versions

Comparing version

to
0.1.6

2

package.json
{
"name": "smtp-channel",
"version": "0.1.5",
"version": "0.1.6",
"description": "Low level SMTP communication layer.",

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

@@ -99,3 +99,3 @@ ![Build Status](https://travis-ci.org/xpepermint/smtp-channel.svg?branch=master) [![NPM Version](https://badge.fury.io/js/smtp-channel.svg)](https://badge.fury.io/js/smtp-channel) [![Dependency Status](https://gemnasium.com/xpepermint/smtp-channel.svg)](https://gemnasium.com/xpepermint/smtp-channel)

| data | String,Stream,Buffer | Yes | - | Data to be sent to the SMTP server. Make sure that you apply to the SMTP rules and complete lines with `\r\n`. When sending email data stream, make sure you include the `.` as the last line.
| handler | Function|Promise | No | - | A method for handling SMTP server replies.
| handler | Function,Promise | No | - | A method for handling SMTP server replies.
| timeout | Integer | No | 0 | A time in milliseconds after the operation automatically rejects (`0` disables the timeout).

@@ -131,2 +131,12 @@

**Event: reply**: (line, {code, isLast}) => {}
> Emitted when a new reply from the server is received.
| Argument | Type | Description
|----------|------|------------
| line | String | SMTP server reply string.
| code | String | SMTP server reply code.
| isLast | Boolean | Is `true` when the `line` represents the last reply from the SMTP server.
**Event: timeout**: () => {}

@@ -133,0 +143,0 @@

@@ -101,3 +101,3 @@ const net = require('net');

parseReplyCode(line) {
return line.substr(0, 3);
return line ? line.substr(0, 3) : null;
}

@@ -114,3 +114,3 @@

isLastReply(line) {
return line.charAt(3) === ' ';
return line ? line.charAt(3) === ' ' : null;
}

@@ -254,5 +254,6 @@

Promise.resolve(line, {code, isLast})
Promise.resolve()
.then(() => {if (handler) handler(line, args)})
.then(() => {if (isLast) resolve(code)});
.then(() => {if (isLast) resolve(code)})
.catch(reject);

@@ -259,0 +260,0 @@ if (isLast) {