nodemailer 6.8.0 → 6.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 6.9.1 2023-01-27
4
+
5
+ - Fix base64 encoding for emoji bytes in encoded words
6
+
7
+ ## 6.9.0 2023-01-12
8
+
9
+ - Do not throw if failed to resolve IPv4 addresses
10
+ - Include EHLO extensions in the send response
11
+ - fix sendMail function: callback should be optional
12
+
3
13
  ## 6.8.0 2022-09-28
4
14
 
5
15
  - Add DNS timeout (huksley)
package/README.md CHANGED
@@ -20,6 +20,10 @@ This project is supported by [Forward Email](https://forwardemail.net) – the 1
20
20
 
21
21
  ---
22
22
 
23
+ This project is supported by [Opensense](https://www.opensense.com) - The beautiful email signature management company for Office 365 and Google Workspace.
24
+
25
+ ---
26
+
23
27
  ## Having an issue?
24
28
 
25
29
  #### First review the docs
@@ -7,6 +7,7 @@ const zlib = require('zlib');
7
7
  const PassThrough = require('stream').PassThrough;
8
8
  const Cookies = require('./cookies');
9
9
  const packageData = require('../../package.json');
10
+ const net = require('net');
10
11
 
11
12
  const MAX_REDIRECTS = 5;
12
13
 
@@ -131,6 +132,10 @@ function nmfetch(url, options) {
131
132
  });
132
133
  }
133
134
 
135
+ if (parsed.protocol === 'https:' && parsed.hostname && parsed.hostname !== reqOptions.host && !net.isIP(parsed.hostname) && !reqOptions.servername) {
136
+ reqOptions.servername = parsed.hostname;
137
+ }
138
+
134
139
  try {
135
140
  req = handler.request(reqOptions);
136
141
  } catch (E) {
@@ -137,7 +137,7 @@ class Mail extends EventEmitter {
137
137
  * @param {Object} data E-data description
138
138
  * @param {Function?} callback Callback to run once the sending succeeded or failed
139
139
  */
140
- sendMail(data, callback) {
140
+ sendMail(data, callback = null) {
141
141
  let promise;
142
142
 
143
143
  if (!callback) {
@@ -84,6 +84,12 @@ module.exports = {
84
84
  let lpart = '';
85
85
  for (let i = 0, len = encodedStr.length; i < len; i++) {
86
86
  let chr = encodedStr.charAt(i);
87
+
88
+ if (/[\ud83c\ud83d\ud83e]/.test(chr) && i < len - 1) {
89
+ // composite emoji byte, so add the next byte as well
90
+ chr += encodedStr.charAt(++i);
91
+ }
92
+
87
93
  // check if we can add this character to the existing string
88
94
  // without breaking byte length limit
89
95
  if (Buffer.byteLength(lpart + chr) <= maxLength || i === 0) {
@@ -216,8 +216,7 @@ module.exports.resolveHostname = (options, callback) => {
216
216
 
217
217
  if (addresses && addresses.length && !address) {
218
218
  // there are addresses but none can be used
219
- let err = new Error(`Can not use IPv${addresses[0].family} addresses with current network`);
220
- return callback(err);
219
+ console.warn(`Failed to resolve IPv${addresses[0].family} addresses with current network`);
221
220
  }
222
221
 
223
222
  if (!address && cached) {
@@ -14,7 +14,7 @@ const shared = require('../shared');
14
14
  const CONNECTION_TIMEOUT = 2 * 60 * 1000; // how much to wait for the connection to be established
15
15
  const SOCKET_TIMEOUT = 10 * 60 * 1000; // how much to wait for socket inactivity before disconnecting the client
16
16
  const GREETING_TIMEOUT = 30 * 1000; // how much to wait after connection is established but SMTP greeting is not receieved
17
- const DNS_TIMEOUT = 30 * 1000; // how much to wait for resolveHostname
17
+ const DNS_TIMEOUT = 30 * 1000; // how much to wait for resolveHostname
18
18
 
19
19
  /**
20
20
  * Generates a SMTP connection object
@@ -1264,6 +1264,12 @@ class SMTPConnection extends EventEmitter {
1264
1264
  return;
1265
1265
  }
1266
1266
 
1267
+ this._ehloLines = str
1268
+ .split(/\r?\n/)
1269
+ .map(line => line.replace(/^\d+[ -]/, '').trim())
1270
+ .filter(line => line)
1271
+ .slice(1);
1272
+
1267
1273
  // Detect if the server supports STARTTLS
1268
1274
  if (!this.secure && !this.options.ignoreTLS && (/[ -]STARTTLS\b/im.test(str) || this.options.requireTLS)) {
1269
1275
  this._sendCommand('STARTTLS');
@@ -1661,6 +1667,10 @@ class SMTPConnection extends EventEmitter {
1661
1667
  rejected: this._envelope.rejected
1662
1668
  };
1663
1669
 
1670
+ if (this._ehloLines && this._ehloLines.length) {
1671
+ response.ehlo = this._ehloLines;
1672
+ }
1673
+
1664
1674
  if (this._envelope.rejectedErrors.length) {
1665
1675
  response.rejectedErrors = this._envelope.rejectedErrors;
1666
1676
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodemailer",
3
- "version": "6.8.0",
3
+ "version": "6.9.1",
4
4
  "description": "Easy as cake e-mail sending from your Node.js applications",
5
5
  "main": "lib/nodemailer.js",
6
6
  "scripts": {
@@ -20,24 +20,24 @@
20
20
  },
21
21
  "homepage": "https://nodemailer.com/",
22
22
  "devDependencies": {
23
- "@aws-sdk/client-ses": "3.180.0",
24
- "aws-sdk": "2.1225.0",
23
+ "@aws-sdk/client-ses": "3.259.0",
24
+ "aws-sdk": "2.1303.0",
25
25
  "bunyan": "1.8.15",
26
- "chai": "4.3.6",
26
+ "chai": "4.3.7",
27
27
  "eslint-config-nodemailer": "1.2.0",
28
- "eslint-config-prettier": "8.5.0",
28
+ "eslint-config-prettier": "8.6.0",
29
29
  "grunt": "1.5.3",
30
30
  "grunt-cli": "1.4.3",
31
- "grunt-eslint": "24.0.0",
31
+ "grunt-eslint": "24.0.1",
32
32
  "grunt-mocha-test": "0.13.3",
33
33
  "libbase64": "1.2.1",
34
- "libmime": "5.1.0",
35
- "libqp": "1.1.0",
36
- "mocha": "10.0.0",
34
+ "libmime": "5.2.0",
35
+ "libqp": "2.0.1",
36
+ "mocha": "10.2.0",
37
37
  "nodemailer-ntlm-auth": "1.0.3",
38
38
  "proxy": "1.0.2",
39
39
  "proxy-test-server": "1.0.0",
40
- "sinon": "14.0.0",
40
+ "sinon": "15.0.1",
41
41
  "smtp-server": "3.11.0"
42
42
  },
43
43
  "engines": {