Socket
Socket
Sign inDemoInstall

nodemailer

Package Overview
Dependencies
0
Maintainers
1
Versions
269
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.7.3 to 6.7.4

.gitattributes

5

CHANGELOG.md
# CHANGELOG
## 6.7.4 2022-04-29
- Ensure compatibility with Node 18
- Replaced Travis with Github Actions
## 6.7.3 2022-03-21

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

8

lib/dkim/index.js

@@ -57,6 +57,6 @@ 'use strict';

this.errored = false;
this.hasErrored = false;
this.input.on('error', err => {
this.errored = true;
this.hasErrored = true;
this.cleanup();

@@ -88,3 +88,3 @@ output.emit('error', err);

sendNextChunk() {
if (this.errored) {
if (this.hasErrored) {
return;

@@ -150,3 +150,3 @@ }

});
this.errored = true;
this.hasErrored = true;
// emit error

@@ -153,0 +153,0 @@ this.output.emit('error', err);

@@ -14,3 +14,3 @@ 'use strict';

module.exports = function (url, options) {
return fetch(url, options);
return nmfetch(url, options);
};

@@ -20,3 +20,3 @@

function fetch(url, options) {
function nmfetch(url, options) {
options = options || {};

@@ -207,3 +207,3 @@

options.body = false;
return fetch(urllib.resolve(url, res.headers.location), options);
return nmfetch(urllib.resolve(url, res.headers.location), options);
}

@@ -210,0 +210,0 @@

@@ -16,3 +16,3 @@ /* eslint no-undefined: 0, prefer-spread: 0, no-control-regex: 0 */

const addressparser = require('../addressparser');
const fetch = require('../fetch');
const nmfetch = require('../fetch');
const LastNewline = require('./last-newline');

@@ -975,3 +975,3 @@

// fetch URL
return fetch(content.href, { headers: content.httpHeaders });
return nmfetch(content.href, { headers: content.httpHeaders });
} else {

@@ -978,0 +978,0 @@ // pass string or buffer content as a stream

@@ -11,3 +11,3 @@ 'use strict';

const SESTransport = require('./ses-transport');
const fetch = require('./fetch');
const nmfetch = require('./fetch');
const packageData = require('../package.json');

@@ -83,3 +83,3 @@

let req = fetch(apiUrl + '/user', {
let req = nmfetch(apiUrl + '/user', {
contentType: 'application/json',

@@ -86,0 +86,0 @@ method: 'POST',

@@ -8,3 +8,3 @@ /* eslint no-console: 0 */

const fs = require('fs');
const fetch = require('../fetch');
const nmfetch = require('../fetch');
const dns = require('dns');

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

const resolver = (family, hostname, callback) => {
const isFamilySupported = family => {
const familySupported =

@@ -27,4 +27,10 @@ // crux that replaces Object.values(networkInterfaces) as Object.values is not supported in nodejs v6

.filter(i => !i.internal)
.filter(i => i.family === 'IPv' + family).length > 0;
.filter(i => i.family === 'IPv' + family || i.family === family).length > 0;
return familySupported;
};
const resolver = (family, hostname, callback) => {
const familySupported = isFamilySupported(family);
if (!familySupported) {

@@ -94,5 +100,5 @@ return callback(null, []);

let cached;
if (dnsCache.has(options.host)) {
cached = dnsCache.get(options.host);
if (!cached.expires || cached.expires >= Date.now()) {

@@ -131,3 +137,3 @@ return callback(

value,
expires: Date.now() + DNS_TTL
expires: Date.now() + (options.dnsTtl || DNS_TTL)
});

@@ -166,3 +172,3 @@

value,
expires: Date.now() + DNS_TTL
expires: Date.now() + (options.dnsTtl || DNS_TTL)
});

@@ -179,3 +185,3 @@

try {
dns.lookup(options.host, {}, (err, address) => {
dns.lookup(options.host, { all: true }, (err, addresses) => {
if (err) {

@@ -195,2 +201,15 @@ if (cached) {

let address = addresses
? addresses
.filter(addr => isFamilySupported(addr.family))
.map(addr => addr.address)
.shift()
: false;
if (addresses && addresses.length && !address) {
// there are addresses but none can be used
let err = new Error(`Can not use IPv${addresses[0].family} addresses with current network`);
return callback(err);
}
if (!address && cached) {

@@ -213,3 +232,3 @@ // nothing was found, fallback to cached value

value,
expires: Date.now() + DNS_TTL
expires: Date.now() + (options.dnsTtl || DNS_TTL)
});

@@ -445,3 +464,3 @@

} else if (/^https?:\/\//i.test(content.path || content.href)) {
contentStream = fetch(content.path || content.href);
contentStream = nmfetch(content.path || content.href);
return resolveStream(contentStream, callback);

@@ -448,0 +467,0 @@ } else if (/^data:/i.test(content.path || content.href)) {

'use strict';
const Stream = require('stream').Stream;
const fetch = require('../fetch');
const nmfetch = require('../fetch');
const crypto = require('crypto');

@@ -313,3 +313,3 @@ const shared = require('../shared');

let req = fetch(url, {
let req = nmfetch(url, {
method: 'post',

@@ -316,0 +316,0 @@ headers: params.customHeaders,

{
"name": "nodemailer",
"version": "6.7.3",
"version": "6.7.4",
"description": "Easy as cake e-mail sending from your Node.js applications",
"main": "lib/nodemailer.js",
"scripts": {
"test": "grunt"
"test": "grunt --trace-warnings"
},

@@ -23,4 +23,4 @@ "repository": {

"devDependencies": {
"@aws-sdk/client-ses": "3.54.1",
"aws-sdk": "2.1096.0",
"@aws-sdk/client-ses": "3.79.0",
"aws-sdk": "2.1124.0",
"bunyan": "1.8.15",

@@ -30,3 +30,3 @@ "chai": "4.3.6",

"eslint-config-prettier": "8.5.0",
"grunt": "1.4.1",
"grunt": "1.5.2",
"grunt-cli": "1.4.3",

@@ -36,3 +36,3 @@ "grunt-eslint": "24.0.0",

"libbase64": "1.2.1",
"libmime": "5.0.0",
"libmime": "5.1.0",
"libqp": "1.1.0",

@@ -43,4 +43,4 @@ "mocha": "9.2.2",

"proxy-test-server": "1.0.0",
"sinon": "13.0.1",
"smtp-server": "3.10.0"
"sinon": "13.0.2",
"smtp-server": "3.11.0"
},

@@ -47,0 +47,0 @@ "engines": {

@@ -38,9 +38,20 @@ # Nodemailer

- If you are running the code on your machine, check your antivirus settings. Antiviruses often mess around with email ports usage. Node.js might not recognize the MITM cert your antivirus is using.
- Latest Node versions allow only TLS versions 1.2 and higher. Some servers might still use TLS 1.1 or lower. Check Node.js docs on how to get correct TLS support for your app.
- You might have the wrong value for the `secure` option. This is `true` _only_ for port 465. For every other port, it should be `false`. Setting `secure` to `false` does not mean that Nodemailer would not use TLS. Nodemailer would still try to upgrade the connection to use TLS if the server supports it.
- Older Node versions do not support the newest Let's Encrypt certificates. Either set `tls.rejectUnauthorized` to `false` or upgrade your Node version
- Latest Node versions allow only TLS versions 1.2 and higher. Some servers might still use TLS 1.1 or lower. Check Node.js docs on how to get correct TLS support for your app. You can change this with [tls.minVersion](https://nodejs.org/dist/latest-v16.x/docs/api/tls.html#tls_tls_createsecurecontext_options) option
- You might have the wrong value for the `secure` option. This should be set to `true` only for port 465. For every other port, it should be `false`. Setting it to `false` does not mean that Nodemailer would not use TLS. Nodemailer would still try to upgrade the connection to use TLS if the server supports it.
- Older Node versions do not fully support the certificate chain of the newest Let's Encrypt certificates. Either set [tls.rejectUnauthorized](https://nodejs.org/dist/latest-v16.x/docs/api/tls.html#tlsconnectoptions-callback) to `false` to skip chain verification or upgrade your Node version
```
let configOptions = {
host: "smtp.example.com",
port: 587,
tls: {
rejectUnauthorized: true,
minVersion: "TLSv1.2"
}
}
```
#### I have issues with DNS / hosts file
Nodemailer uses `dns.resolve4()` and `dns.resolve6()` to resolve hostname into an IP address. If both calls fail, then Nodemailer will fall back to `dns.lookup()`. If this does not work for you, you can hard code the IP address into the configuration. In that case, Nodemailer would not perform any DNS lookups.
Node.js uses [c-ares](https://nodejs.org/en/docs/meta/topics/dependencies/#c-ares) to resolve domain names, not the DNS library provided by the system, so if you have some custom DNS routing set up, it might be ignored. Nodemailer runs [dns.resolve4()](https://nodejs.org/dist/latest-v16.x/docs/api/dns.html#dnsresolve4hostname-options-callback) and [dns.resolve6()](https://nodejs.org/dist/latest-v16.x/docs/api/dns.html#dnsresolve6hostname-options-callback) to resolve hostname into an IP address. If both calls fail, then Nodemailer will fall back to [dns.lookup()](https://nodejs.org/dist/latest-v16.x/docs/api/dns.html#dnslookuphostname-options-callback). If this does not work for you, you can hard code the IP address into the configuration like shown below. In that case, Nodemailer would not perform any DNS lookups.

@@ -59,2 +70,6 @@ ```

#### I have an issue with TypeScript types
Nodemailer has official support for Node.js only. For anything related to TypeScript, you need to directly contact the authors of the [type definitions](https://www.npmjs.com/package/@types/nodemailer).
#### I have a different problem

@@ -61,0 +76,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc