mailparser 3.6.3 → 3.6.5
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/lib/mail-parser.js +9 -7
- package/lib/simple-parser.js +1 -1
- package/package.json +11 -11
package/lib/mail-parser.js
CHANGED
|
@@ -509,14 +509,18 @@ class MailParser extends Transform {
|
|
|
509
509
|
}
|
|
510
510
|
|
|
511
511
|
decodeAddresses(addresses) {
|
|
512
|
+
let processedAddress = new WeakSet();
|
|
512
513
|
for (let i = 0; i < addresses.length; i++) {
|
|
513
514
|
let address = addresses[i];
|
|
514
515
|
address.name = (address.name || '').toString().trim();
|
|
515
516
|
|
|
516
|
-
if (!address.address && /^(=\?([^?]+)\?[Bb]\?[^?]*\?=)(\s*=\?([^?]+)\?[Bb]\?[^?]*\?=)*$/.test(address.name)) {
|
|
517
|
+
if (!address.address && /^(=\?([^?]+)\?[Bb]\?[^?]*\?=)(\s*=\?([^?]+)\?[Bb]\?[^?]*\?=)*$/.test(address.name) && !processedAddress.has(address)) {
|
|
517
518
|
let parsed = addressparser(this.libmime.decodeWords(address.name));
|
|
518
519
|
if (parsed.length) {
|
|
519
|
-
parsed.forEach(entry =>
|
|
520
|
+
parsed.forEach(entry => {
|
|
521
|
+
processedAddress.add(entry);
|
|
522
|
+
addresses.push(entry);
|
|
523
|
+
});
|
|
520
524
|
}
|
|
521
525
|
|
|
522
526
|
// remove current element
|
|
@@ -1045,11 +1049,9 @@ class MailParser extends Transform {
|
|
|
1045
1049
|
html.replace(/\bcid:([^'"\s]{1,256})/g, (match, cid) => {
|
|
1046
1050
|
for (let i = 0, len = this.attachmentList.length; i < len; i++) {
|
|
1047
1051
|
if (this.attachmentList[i].cid === cid && /^image\/[\w]+$/i.test(this.attachmentList[i].contentType)) {
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
});
|
|
1052
|
-
}
|
|
1052
|
+
cids.set(cid, {
|
|
1053
|
+
attachment: this.attachmentList[i]
|
|
1054
|
+
});
|
|
1053
1055
|
break;
|
|
1054
1056
|
}
|
|
1055
1057
|
}
|
package/lib/simple-parser.js
CHANGED
|
@@ -87,7 +87,7 @@ module.exports = (input, options, callback) => {
|
|
|
87
87
|
|
|
88
88
|
parser.on('end', () => {
|
|
89
89
|
['subject', 'references', 'date', 'to', 'from', 'to', 'cc', 'bcc', 'message-id', 'in-reply-to', 'reply-to'].forEach(key => {
|
|
90
|
-
if (mail.headers.has(key)) {
|
|
90
|
+
if (mail.headers && mail.headers.has(key)) {
|
|
91
91
|
mail[key.replace(/-([a-z])/g, (m, c) => c.toUpperCase())] = mail.headers.get(key);
|
|
92
92
|
}
|
|
93
93
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mailparser",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.5",
|
|
4
4
|
"description": "Parse e-mails",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,23 +18,23 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"encoding-japanese": "2.0.0",
|
|
20
20
|
"he": "1.2.0",
|
|
21
|
-
"html-to-text": "9.0.
|
|
21
|
+
"html-to-text": "9.0.5",
|
|
22
22
|
"iconv-lite": "0.6.3",
|
|
23
|
-
"libmime": "5.2.
|
|
23
|
+
"libmime": "5.2.1",
|
|
24
24
|
"linkify-it": "4.0.1",
|
|
25
25
|
"mailsplit": "5.4.0",
|
|
26
|
-
"nodemailer": "6.
|
|
27
|
-
"tlds": "1.
|
|
26
|
+
"nodemailer": "6.9.3",
|
|
27
|
+
"tlds": "1.240.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"ajv": "8.
|
|
31
|
-
"eslint": "8.
|
|
30
|
+
"ajv": "8.12.0",
|
|
31
|
+
"eslint": "8.44.0",
|
|
32
32
|
"eslint-config-nodemailer": "1.2.0",
|
|
33
|
-
"eslint-config-prettier": "8.
|
|
34
|
-
"grunt": "1.
|
|
33
|
+
"eslint-config-prettier": "8.8.0",
|
|
34
|
+
"grunt": "1.6.1",
|
|
35
35
|
"grunt-cli": "1.4.3",
|
|
36
|
-
"grunt-contrib-nodeunit": "
|
|
37
|
-
"grunt-eslint": "24.0
|
|
36
|
+
"grunt-contrib-nodeunit": "5.0.0",
|
|
37
|
+
"grunt-eslint": "24.2.0",
|
|
38
38
|
"iconv": "3.0.1",
|
|
39
39
|
"random-message": "1.1.0"
|
|
40
40
|
},
|