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

emailjs

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emailjs - npm Package Compare versions

Comparing version 3.2.1 to 3.3.0

73

CHANGELOG.md

@@ -7,4 +7,77 @@ # Changelog

## [3.3.0] - TBD
### Added
- greylist support [#202](https://github.com/eleith/emailjs/issues/202)
### Fixed
- check socket is writable before sending [#205](https://github.com/eleith/emailjs/issues/205)
## [3.2.1] - 2020-06-27
### Fixed
- use correct type for `MessageAttachment.stream` [#261](https://github.com/eleith/emailjs/issues/261)
- add missing types in mime functions [#262](https://github.com/eleith/emailjs/pull/262)
## [3.2.0] - 2020-06-19
### Added
- `addressparser` API (forked from dropped dependency) [#259](https://github.com/eleith/emailjs/issues/259)
- `mimeEncode`/`mimeWordEncode` APIs (forked from dropped dependency) [#247](https://github.com/eleith/emailjs/issues/247)
### Changed
- drop dependency on `addressparser` [#259](https://github.com/eleith/emailjs/issues/259)
- drop dependency on `emailjs-mime-codec` [#247](https://github.com/eleith/emailjs/issues/247)
### Fixed
- make `MessageAttachment` interface usable [#254](https://github.com/eleith/emailjs/issues/254)
- mend regression in address type validation [#252](https://github.com/eleith/emailjs/pull/252)
## [3.1.0] - 2020-06-19 [YANKED]
## [3.0.0] - 2020-05-28
### Added
- convert source to strict typescript, listed under the `types` field in `package.json`
- support "dual-package" ESM + CJS via [conditional exports](https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_conditional_exports) & `rollup`-generated bundles
- `SMTPClient#creatMessageStack` API [#229](https://github.com/eleith/emailjs/issues/229)
- `SMTPError` API
### Changed
- simplify public API [#249](https://github.com/eleith/emailjs/issues/249)
- rename `Client` -> `SMTPClient` [#249](https://github.com/eleith/emailjs/issues/249)
- rename `SMTPResponse` -> `SMTPResponseMonitor` [#249](https://github.com/eleith/emailjs/issues/249)
### Removed
- `Message#attach_alternative` API
- `makeSMTPError` API
### Fixed
- filter duplicate message recipients [#242](https://github.com/eleith/emailjs/issues/242)
- error when passing `password` without `user` [#199](https://github.com/eleith/emailjs/issues/199)
- trim `host` before connecting [#136](https://github.com/eleith/emailjs/issues/136)
## [2.2.0] - 2018-07-06
### Added
- expose rfc2822 date module
- annotate code with typescript-compatible jsdoc tags
### Changed
- drop dependency on `moment`
- drop dependency on `starttls`
### Fixed
- ensure timeout is set to default value [#225](https://github.com/eleith/emailjs/issues/225)
## [2.1.0] - 2018-06-09
### Added
- expose error module
### Changed
- handle errors with `fs.closeSync` instead of `fs.close`
- refactor to ES2015+ constructs
- lint & format with eslint + prettier
- drop optional dependency on `bufferjs`
### Fixed
- remove `new Buffer` calls
## [2.0.1] - 2018-02-11
### Added
- a new changelog

22

package.json
{
"name": "emailjs",
"description": "send text/html emails and attachments (files, streams and strings) from node.js to any smtp server",
"version": "3.2.1",
"version": "3.3.0",
"author": "eleith",

@@ -20,20 +20,18 @@ "contributors": [

"@ledge/configs": "23.0.0",
"@rollup/plugin-commonjs": "13.0.0",
"@rollup/plugin-node-resolve": "8.1.0",
"@rollup/plugin-typescript": "5.0.0",
"@rollup/plugin-typescript": "5.0.2",
"@types/mailparser": "2.7.3",
"@types/smtp-server": "3.5.4",
"@typescript-eslint/eslint-plugin": "3.4.0",
"@typescript-eslint/parser": "3.4.0",
"ava": "3.9.0",
"eslint": "7.3.1",
"@typescript-eslint/eslint-plugin": "3.7.1",
"@typescript-eslint/parser": "3.7.1",
"ava": "3.11.0",
"eslint": "7.5.0",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-prettier": "3.1.4",
"mailparser": "2.7.7",
"mailparser": "2.8.0",
"prettier": "2.0.5",
"rollup": "2.18.0",
"rollup": "2.23.0",
"smtp-server": "3.7.0",
"ts-node": "8.10.2",
"tslib": "2.0.0",
"typescript": "3.9.5"
"typescript": "3.9.7"
},

@@ -58,3 +56,3 @@ "engine": [

"tsc": "tsc",
"test": "ava --serial",
"test": "ava",
"test-cjs": "npm run build && npm run test -- --node-arguments='--title=cjs'"

@@ -61,0 +59,0 @@ },

@@ -18,2 +18,3 @@ # emailjs [![Test Status](https://github.com/eleith/emailjs/workflows/.github/workflows/test.yml/badge.svg)](https://github.com/eleith/emailjs/actions?query=workflow%3A.github%2Fworkflows%2Ftest.yml)

- built-in type declarations
- automatically handles [greylisting](http://projects.puremagic.com/greylisting/whitepaper.html)

@@ -20,0 +21,0 @@ ## REQUIRES

import { addressparser } from './address';
import { Message } from './message';
import type { MessageAttachment, MessageHeaders } from './message';
import { SMTPConnection, SMTPState } from './connection';
import type { SMTPConnectionOptions } from './connection';
import { Message, MessageAttachment, MessageHeaders } from './message';
import { SMTPConnection, SMTPConnectionOptions, SMTPState } from './connection';

@@ -7,0 +5,0 @@ export interface MessageStack {

@@ -5,4 +5,8 @@ import { createHmac } from 'crypto';

import { hostname } from 'os';
import { connect, createSecureContext, TLSSocket } from 'tls';
import type { ConnectionOptions } from 'tls';
import {
connect,
createSecureContext,
ConnectionOptions,
TLSSocket,
} from 'tls';

@@ -39,2 +43,3 @@ import { SMTPError, SMTPErrorStates } from './error';

const CRLF = '\r\n' as const;
const GREYLIST_DELAY = 300 as const;

@@ -120,2 +125,7 @@ let DEBUG: 0 | 1 = 0;

private greylistResponseTracker = new WeakMap<
(...rest: any[]) => void,
boolean
>();
/**

@@ -350,3 +360,3 @@ * SMTP class written using python's (2.7) smtplib.py as a base.

public send(str: string, callback: (...args: any[]) => void) {
if (this.sock && this._state === SMTPState.CONNECTED) {
if (this.sock != null && this._state === SMTPState.CONNECTED) {
this.log(str);

@@ -362,3 +372,5 @@

});
this.sock.write(str);
if (this.sock.writable) {
this.sock.write(str);
}
} else {

@@ -401,4 +413,14 @@ this.close(true);

} else {
if (codesArray.indexOf(Number(msg.code)) !== -1) {
const code = Number(msg.code);
if (codesArray.indexOf(code) !== -1) {
caller(callback, err, msg.data, msg.message);
} else if (
(code === 450 || code === 451) &&
msg.message.toLowerCase().includes('greylist') &&
this.greylistResponseTracker.get(response) === false
) {
this.greylistResponseTracker.set(response, true);
setTimeout(() => {
this.send(cmd + CRLF, response);
}, GREYLIST_DELAY);
} else {

@@ -422,2 +444,3 @@ const suffix = msg.message ? `: ${msg.message}` : '';

this.greylistResponseTracker.set(response, false);
this.send(cmd + CRLF, response);

@@ -424,0 +447,0 @@ }

@@ -1,3 +0,2 @@

import fs from 'fs';
import type { PathLike } from 'fs';
import fs, { PathLike } from 'fs';
import { hostname } from 'os';

@@ -239,3 +238,2 @@ import { Stream } from 'stream';

public stream() {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
return new MessageStream(this);

@@ -445,18 +443,16 @@ }

) => {
if (attachment.stream != null && attachment.stream.readable) {
const { stream } = attachment;
if (stream?.readable) {
let previous = Buffer.alloc(0);
attachment.stream.resume();
stream.resume();
attachment.stream.on('end', () => {
stream.on('end', () => {
output_base64(previous.toString('base64'), callback);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.removeListener('pause', attachment.stream!.pause);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.removeListener('resume', attachment.stream!.resume);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.removeListener('error', attachment.stream!.resume);
this.removeListener('pause', stream.pause);
this.removeListener('resume', stream.resume);
this.removeListener('error', stream.resume);
});
attachment.stream.on('data', (buff) => {
stream.on('data', (buff) => {
// do we have bytes from a previous stream data event?

@@ -480,5 +476,5 @@ let buffer = Buffer.isBuffer(buff) ? buff : Buffer.from(buff);

this.on('pause', attachment.stream.pause);
this.on('resume', attachment.stream.resume);
this.on('error', attachment.stream.resume);
this.on('pause', stream.pause);
this.on('resume', stream.resume);
this.on('error', stream.resume);
} else {

@@ -485,0 +481,0 @@ this.emit('error', { message: 'stream not readable' });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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