nodemailer 6.0.0 → 6.3.0

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/.DS_Store ADDED
Binary file
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 6.2.1 2019-05-24
4
+
5
+ - No changes. It is the same as 6.2.0 that was accidentally published as 6.2.1 to npm
6
+
7
+ ## 6.2.0 2019-05-24
8
+
9
+ - Added new option for addressparser: `flatten`. If true then ignores group names and returns a single list of all addresses
10
+
11
+ ## 6.1.1 2019-04-20
12
+
13
+ - Fixed regression bug with missing smtp `authMethod` property
14
+
15
+ ## 6.1.0 2019-04-06
16
+
17
+ - Added new message property `amp` for providing AMP4EMAIL content
18
+
3
19
  ## 6.0.0 2019-03-25
4
20
 
5
21
  - SMTPConnection: use removeListener instead of removeAllListeners (xr0master) [ddc4af15]
package/lib/.DS_Store ADDED
Binary file
@@ -255,7 +255,9 @@ class Tokenizer {
255
255
  * @param {String} str Address field
256
256
  * @return {Array} An array of address objects
257
257
  */
258
- function addressparser(str) {
258
+ function addressparser(str, options) {
259
+ options = options || {};
260
+
259
261
  let tokenizer = new Tokenizer(str);
260
262
  let tokens = tokenizer.tokenize();
261
263
 
@@ -285,6 +287,21 @@ function addressparser(str) {
285
287
  }
286
288
  });
287
289
 
290
+ if (options.flatten) {
291
+ let addresses = [];
292
+ let walkAddressList = list => {
293
+ list.forEach(address => {
294
+ if (address.group) {
295
+ return walkAddressList(address.group);
296
+ } else {
297
+ addresses.push(address);
298
+ }
299
+ });
300
+ };
301
+ walkAddressList(parsedAddresses);
302
+ return addresses;
303
+ }
304
+
288
305
  return parsedAddresses;
289
306
  }
290
307
 
@@ -128,7 +128,8 @@ class MailComposer {
128
128
  };
129
129
  } else if (attachment.href) {
130
130
  data.content = {
131
- href: attachment.href
131
+ href: attachment.href,
132
+ httpHeaders: attachment.httpHeaders
132
133
  };
133
134
  } else {
134
135
  data.content = attachment.content || '';
@@ -194,6 +195,7 @@ class MailComposer {
194
195
  text,
195
196
  html,
196
197
  watchHtml,
198
+ amp,
197
199
  icalEvent,
198
200
  eventObject;
199
201
 
@@ -222,6 +224,17 @@ class MailComposer {
222
224
  watchHtml.contentType = 'text/watch-html' + (!watchHtml.encoding && mimeFuncs.isPlainText(watchHtml.content) ? '' : '; charset=utf-8');
223
225
  }
224
226
 
227
+ if (this.mail.amp) {
228
+ if (typeof this.mail.amp === 'object' && (this.mail.amp.content || this.mail.amp.path || this.mail.amp.href || this.mail.amp.raw)) {
229
+ amp = this.mail.amp;
230
+ } else {
231
+ amp = {
232
+ content: this.mail.amp
233
+ };
234
+ }
235
+ amp.contentType = 'text/x-amp-html' + (!amp.encoding && mimeFuncs.isPlainText(amp.content) ? '' : '; charset=utf-8');
236
+ }
237
+
225
238
  // only include the calendar alternative if there are no attachments
226
239
  // otherwise you might end up in a blank screen on some clients
227
240
  if (this.mail.icalEvent && !(this.mail.attachments && this.mail.attachments.length)) {
@@ -273,6 +286,7 @@ class MailComposer {
273
286
  []
274
287
  .concat(text || [])
275
288
  .concat(watchHtml || [])
289
+ .concat(amp || [])
276
290
  .concat(html || [])
277
291
  .concat(eventObject || [])
278
292
  .concat(this.mail.alternatives || [])
@@ -47,7 +47,7 @@ class MailMessage {
47
47
  }
48
48
 
49
49
  resolveAll(callback) {
50
- let keys = [[this.data, 'html'], [this.data, 'text'], [this.data, 'watchHtml'], [this.data, 'icalEvent']];
50
+ let keys = [[this.data, 'html'], [this.data, 'text'], [this.data, 'watchHtml'], [this.data, 'amp'], [this.data, 'icalEvent']];
51
51
 
52
52
  if (this.data.alternatives && this.data.alternatives.length) {
53
53
  this.data.alternatives.forEach((alternative, i) => {
@@ -147,7 +147,7 @@ class MailMessage {
147
147
  data.envelope = envelope;
148
148
  data.messageId = messageId;
149
149
 
150
- ['html', 'text', 'watchHtml'].forEach(key => {
150
+ ['html', 'text', 'watchHtml', 'amp'].forEach(key => {
151
151
  if (data[key] && data[key].content) {
152
152
  if (typeof data[key].content === 'string') {
153
153
  data[key] = data[key].content;
@@ -971,7 +971,7 @@ class MimeNode {
971
971
  return contentStream;
972
972
  }
973
973
  // fetch URL
974
- return fetch(content.href);
974
+ return fetch(content.href, { headers: content.httpHeaders });
975
975
  } else {
976
976
  // pass string or buffer content as a stream
977
977
  contentStream = new PassThrough();
@@ -46,7 +46,7 @@ class PoolResource extends EventEmitter {
46
46
  pass: this.options.auth.pass,
47
47
  options: this.options.auth.options
48
48
  },
49
- method: (this.options.auth.method || '').trim().toUpperCase() || false
49
+ method: (this.options.auth.method || '').trim().toUpperCase() || this.options.authMethod || false
50
50
  };
51
51
  }
52
52
  }
@@ -121,7 +121,7 @@ class SMTPTransport extends EventEmitter {
121
121
  pass: authData.pass,
122
122
  options: authData.options
123
123
  },
124
- method: (authData.method || '').trim().toUpperCase() || false
124
+ method: (authData.method || '').trim().toUpperCase() || this.options.authMethod || false
125
125
  };
126
126
  }
127
127
  }
@@ -67,10 +67,7 @@
67
67
  "aliases": ["Outlook", "Outlook.com", "Hotmail.com"],
68
68
  "domains": ["hotmail.com", "outlook.com"],
69
69
  "host": "smtp.live.com",
70
- "port": 587,
71
- "tls": {
72
- "ciphers": "SSLv3"
73
- }
70
+ "port": 587
74
71
  },
75
72
 
76
73
  "iCloud": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodemailer",
3
- "version": "6.0.0",
3
+ "version": "6.3.0",
4
4
  "description": "Easy as cake e-mail sending from your Node.js applications",
5
5
  "main": "lib/nodemailer.js",
6
6
  "scripts": {
@@ -23,19 +23,19 @@
23
23
  "bunyan": "1.8.12",
24
24
  "chai": "4.2.0",
25
25
  "eslint-config-nodemailer": "1.2.0",
26
- "eslint-config-prettier": "4.1.0",
26
+ "eslint-config-prettier": "6.0.0",
27
27
  "grunt": "1.0.4",
28
28
  "grunt-cli": "1.3.2",
29
- "grunt-eslint": "21.0.0",
29
+ "grunt-eslint": "22.0.0",
30
30
  "grunt-mocha-test": "0.13.3",
31
31
  "libbase64": "1.0.3",
32
- "libmime": "4.0.1",
32
+ "libmime": "4.1.3",
33
33
  "libqp": "1.1.0",
34
- "mocha": "5.2.0",
34
+ "mocha": "6.1.4",
35
35
  "nodemailer-ntlm-auth": "1.0.1",
36
36
  "proxy": "0.2.4",
37
37
  "proxy-test-server": "1.0.0",
38
- "sinon": "7.3.0",
38
+ "sinon": "7.3.2",
39
39
  "smtp-server": "3.5.0"
40
40
  },
41
41
  "engines": {