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

mx-connect

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mx-connect - npm Package Compare versions

Comparing version 1.4.4 to 1.5.1

.github/FUNDING.yml

18

lib/format-address.js

@@ -21,12 +21,14 @@ 'use strict';

// the result does not seem to be either IPv4 or IPv6 address
let err = new Error(delivery.decodedDomain + ' does not appear to be a properly formatted IP address');
err.response = '550 ' + err.message;
err.category = 'compliancy';
return Promise.reject(err);
let error = new Error(delivery.decodedDomain + ' does not appear to be a properly formatted IP address');
error.response = `DNS Error: ${error.message}`;
error.category = 'compliancy';
return Promise.reject(error);
}
if (net.isIPv6(delivery.decodedDomain) && dnsOptions.ignoreIPv6) {
let err = new Error(delivery.decodedDomain + ': Can not send mail to IPv6 addresses');
err.response = '550 ' + err.message;
err.category = 'dns';
return Promise.reject(err);
let error = new Error(
`The Mail Exchange (MX) resolved to an IPv6 address "${delivery.decodedDomain}". However, sending mail to IPv6 addresses is not supported in the current configuration`
);
error.response = `Network error: ${error.message}`;
error.category = 'dns';
return Promise.reject(error);
}

@@ -33,0 +35,0 @@ } else {

@@ -54,16 +54,17 @@ 'use strict';

// we did have some hosts listed but these were filtered out
let err;
let error;
if (delivery.mxLastError) {
err = delivery.mxLastError;
error = delivery.mxLastError;
} else {
err = new Error('Could not connect to MX of ' + delivery.domain);
err.response = '450 ' + err.message;
err.category = 'connect';
error = new Error(`Connection to the Mail Exchange (MX) server of "${delivery.domain}" failed`);
error.response = `Netowrk error: ${error.message}`;
error.category = 'connect';
error.temporary = true;
}
return reject(err);
return reject(error);
}
let err = new Error('Could not find any MX servers for ' + delivery.domain);
err.response = '550 ' + err.message;
err.category = 'dns';
return reject(err);
let error = new Error(`No Mail Exchange (MX) servers were found for "${delivery.domain}"`);
error.response = `DNS Error: ${error.message}`;
error.category = 'dns';
return reject(error);
}

@@ -94,6 +95,7 @@

if (tried >= mxHosts.length) {
let err = firstError || new Error('Could not connect to any of the MX servers for ' + delivery.domain);
err.response = err.response || '450 ' + err.message;
err.category = err.category || 'network';
return reject(err);
let error =
firstError || new Error(`Unable to establish a connection with any of the Mail Exchange (MX) servers listed for "${delivery.domain}"`);
error.response = error.response || `Network error: ${error.message}`;
error.category = error.category || 'network';
return reject(error);
}

@@ -172,9 +174,8 @@

});
let code = 554;
let err = new Error(`MTA-STS policy check failed for ${mx.hostname}[${mx.host}] for ${delivery.domain}`);
err.response = code + ' ' + err.message;
err.category = 'policy';
emitConnectError(err);
let error = new Error(`MTA-STS policy check failed for ${mx.hostname}[${mx.host}] for ${delivery.domain}`);
error.response = `Policy error: ${error.message}`;
error.category = 'policy';
emitConnectError(error);
if (!firstError) {
firstError = err;
firstError = error;
}

@@ -230,8 +231,8 @@ return setImmediate(tryNextMX);

if (err) {
let code = 450;
err.message = `Network error when connecting to MX server ${mx.hostname}[${mx.host}] for ${delivery.domain}: ${
netErrors[err.code] || netErrors[err.errno] || err.message
}`;
err.response = err.response || code + ' ' + err.message;
err.response = err.response || `Netowrk error: ${err.message}`;
err.category = err.category || 'network';
err.temporary = true;
emitConnectError(err);

@@ -254,9 +255,11 @@ if (!firstError) {

connected = true;
let code = 450;
let err = new Error(`Connection timed out when connecting to MX server ${mx.hostname}[${mx.host}] for ${delivery.domain}`);
err.response = code + ' ' + err.message;
err.category = 'network';
emitConnectError(err);
let error = new Error(`Connection timed out when connecting to MX server ${mx.hostname}[${mx.host}] for ${delivery.domain}`);
error.response = `Network error: ${err.message}`;
error.category = 'network';
error.temporary = true;
emitConnectError(error);
if (!firstError) {
firstError = err;
firstError = error;
}

@@ -263,0 +266,0 @@ return setImmediate(tryNextMX);

@@ -52,10 +52,7 @@ 'use strict';

// so we return 4xx
firstError.response =
'450 Failed to resolve IP address for ' +
ip.exchange +
' of the MX server for ' +
delivery.domain +
'. ' +
(dnsErrors[firstError.code] || firstError.message);
firstError.response = `DNS Error: Unable to resolve the IP address for the specified host [${
ip.exchange
}] of the Mail Exchange (MX) server for the domain "${delivery.domain}". ${dnsErrors[firstError.code] || firstError.message}`;
firstError.category = 'dns';
firstError.temporary = true;
}

@@ -68,10 +65,9 @@ return false;

firstError = new Error(
'Can not send mail to the resolved IP address [' +
ip +
'] of the MX server for ' +
delivery.domain +
(typeof invalid === 'string' ? '. ' + invalid : '')
`Unable to deliver email to the IP address [${ip}] resolved for the Mail Exchange (MX) server of "${delivery.domain}"${
typeof invalid === 'string' ? `. ${invalid}` : ''
}`
);
// Invalid IP, so nothing to do here, return 5xx
firstError.response = '550 ' + firstError.message;
firstError.code = 'InvalidIpAddress';
firstError.response = `DNS Error: ${firstError.message}`;
firstError.category = 'dns';

@@ -116,6 +112,7 @@ }

// nothing found, we end up here with ENOTFOUND, so return 5xx
let err = new Error('Could not resolve any IP addresses for the MX server for ' + delivery.domain);
err.response = '550 ' + err.message;
err.category = 'dns';
return reject(err);
let error = new Error(`Failed to resolve any IP addresses for the Mail Exchange (MX) server associated with "${delivery.domain}"`);
error.code = 'ENOTFOUND';
error.response = `DNS Error: ${error.message}`;
error.category = 'dns';
return reject(error);
}

@@ -122,0 +119,0 @@ resolve(delivery);

@@ -22,9 +22,7 @@ 'use strict';

firstError = new Error(
'Can not send mail to the resolved IP address [' +
ip +
'] of the MX server for ' +
delivery.domain +
(typeof invalid === 'string' ? '. ' + invalid : '')
`Unable to deliver email to the IP address [${ip}] resolved for the Mail Exchange (MX) server of "${delivery.domain}"${
typeof invalid === 'string' ? `. ${invalid}` : ''
}`
);
firstError.response = '550 ' + firstError.message;
firstError.response = `DNS Error: ${firstError.message}`;
firstError.category = 'dns';

@@ -60,6 +58,8 @@ }

if (err && err.code !== 'ENODATA' && err.code !== 'ENOTFOUND') {
err.message = `DNS error occurred while resolving the Mail Exchange (MX) server for the specified domain (${domain}). ${
dnsErrors[err.code] || err.message
}`;
err.response = `DNS Error: ${err.message}`;
err.temporary = true; // this might be a temporary issue with DNS
err.category = 'dns';
err.message = 'DNS error when resolving MX server for ' + domain + ': ' + (dnsErrors[err.code] || err.message);
err.response = '450 ' + err.message;
err.temporary = true; // this might be a temporary issue with DNS
return reject(err);

@@ -72,4 +72,7 @@ }

if (err && err.code !== 'ENODATA' && err.code !== 'ENOTFOUND') {
err.message = 'DNS error when resolving MX server for ' + domain + ': ' + (dnsErrors[err.code] || err.message);
err.response = '450 ' + err.message;
err.message = `DNS error occurred while resolving the Mail Exchange (MX) server for the specified domain (${domain}). ${
dnsErrors[err.code] || err.message
}`;
err.response = `DNS Error: ${err.message}`;
err.temporary = true; // this might be a temporary issue with DNS
err.category = 'dns';

@@ -83,4 +86,7 @@ return reject(err);

if (err && err.code !== 'ENODATA' && err.code !== 'ENOTFOUND') {
err.message = 'DNS error when resolving MX server for ' + domain + ': ' + (dnsErrors[err.code] || err.message);
err.response = '450 ' + err.message;
err.message = `DNS error occurred while resolving the Mail Exchange (MX) server for the specified domain (${domain}). ${
dnsErrors[err.code] || err.message
}`;
err.response = `DNS Error: ${err.message}`;
err.temporary = true; // this might be a temporary issue with DNS
err.category = 'dns';

@@ -93,4 +99,7 @@ return reject(err);

err = err || new Error('No MX server found');
err.message = 'DNS error when resolving MX server for ' + domain + ': ' + (dnsErrors[err.code] || err.message);
err.response = '550 ' + err.message;
err.message = `DNS error occurred while resolving the Mail Exchange (MX) server for the specified domain (${domain}). ${
dnsErrors[err.code] || err.message
}`;
err.response = `DNS Error: ${err.message}`;
err.code = err.code || 'ENOTFOUND';
err.category = 'dns';

@@ -97,0 +106,0 @@ return reject(err);

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

if (['loopback', 'private'].includes(range)) {
return 'IP address in disallowed ' + range + ' range';
return `This IP address falls within the prohibited "${range}" address range, which is not valid for external communication.`;
}

@@ -43,3 +43,3 @@

if (module.exports.isLocal(ip)) {
return 'IP address in local interface';
return `The resolved IP address corresponds to a local interface.`;
}

@@ -50,3 +50,3 @@ }

if (['unspecified', 'broadcast'].includes(range)) {
return 'IP address in disallowed ' + range + ' range';
return `The IP address is within the disallowed "${range}" address range, which is not permitted for direct communication.`;
}

@@ -53,0 +53,0 @@

{
"name": "mx-connect",
"version": "1.4.4",
"version": "1.5.1",
"description": "Establish TCP connection to a MX server",
"main": "lib/mx-connect.js",
"scripts": {
"test": "grunt"
"test": "grunt",
"update": "rm -rf node_modules package-lock.json && ncu -u && npm install"
},

@@ -26,12 +27,12 @@ "repository": {

"eslint-config-nodemailer": "1.2.0",
"eslint-config-prettier": "8.8.0",
"eslint-config-prettier": "9.1.0",
"grunt": "1.6.1",
"grunt-cli": "1.4.3",
"grunt-contrib-nodeunit": "5.0.0",
"grunt-eslint": "24.1.0"
"grunt-eslint": "24.3.0"
},
"dependencies": {
"ipaddr.js": "2.0.1",
"mailauth": "4.3.4"
"ipaddr.js": "2.1.0",
"mailauth": "4.6.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