email-forward-parser 1.0.16 → 1.0.19
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/README.md +3 -2
- package/lib/parser.js +77 -50
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ _👋 You use this library and you want to be listed there? [Contact us](https:/
|
|
|
24
24
|
## Features
|
|
25
25
|
|
|
26
26
|
This library is used at [Crisp](https://crisp.chat/) everyday with around 1 million inbound emails.
|
|
27
|
-
* Supported clients: Apple Mail, Gmail, Outlook Live, Outlook 2013, Outlook 2019, New Outlook 2019, Yahoo Mail, Thunderbird
|
|
27
|
+
* Supported clients: Apple Mail, Gmail, Outlook Live / 365, Outlook 2013, Outlook 2019, New Outlook 2019, Yahoo Mail, Thunderbird, Missive
|
|
28
28
|
* Supported locales: Croatian, Czech, Danish, Dutch, English, French, Finnish, German, Hungarian, Italian, Norwegian, Polish, Portuguese (Brazil), Portuguese (Portugal), Romanian, Russian, Slovak, Spanish, Swedish, Turkish, Ukrainian
|
|
29
29
|
|
|
30
30
|
## Usage
|
|
@@ -89,12 +89,13 @@ Client | Detectable via subject | Detectable via separator | Subject localized |
|
|
|
89
89
|
--- | --- | --- | --- | --- | --- | --- | ---
|
|
90
90
|
Apple Mail | Yes | Yes | Yes | Yes | Yes | Yes | --
|
|
91
91
|
Gmail | Yes | Yes | No | No | Yes | Only some parts | --
|
|
92
|
-
Outlook Live | Yes | Yes | Yes | No | Yes | No | --
|
|
92
|
+
Outlook Live / 365 | Yes | Yes | Yes | No | Yes | No | --
|
|
93
93
|
Outlook 2013 | Yes | No | ? | -- | ? | ? | --
|
|
94
94
|
Outlook 2019 | Yes | Yes | No | Yes | No | Yes | The From and Date parts (only original information available) are embedded in the separator, rather than the body itself
|
|
95
95
|
New Outlook 2019 | Yes | No | Yes | -- | Yes | Yes | --
|
|
96
96
|
Yahoo Mail | Yes | Yes | No | Yes | Yes | Yes | The original information are all stuck to each other, without line breaks
|
|
97
97
|
Thunderbird | Yes | Yes | No | Yes | Yes | Yes | --
|
|
98
|
+
Missive | Yes | Yes | No | No | Yes | No | --
|
|
98
99
|
|
|
99
100
|
## Contributing
|
|
100
101
|
|
package/lib/parser.js
CHANGED
|
@@ -7,7 +7,7 @@ var { loopRegexes, trimString } = require("./utils");
|
|
|
7
7
|
|
|
8
8
|
var MAILBOXES_SEPARATORS = [
|
|
9
9
|
",", // Apple Mail, Gmail, New Outlook 2019, Thunderbird
|
|
10
|
-
";" // Outlook Live, Yahoo Mail
|
|
10
|
+
";" // Outlook Live / 365, Yahoo Mail
|
|
11
11
|
];
|
|
12
12
|
|
|
13
13
|
var REGEXES = {
|
|
@@ -18,22 +18,22 @@ var REGEXES = {
|
|
|
18
18
|
byte_order_mark : /[\uFEFF]/gm, // Outlook 2019
|
|
19
19
|
|
|
20
20
|
subject : [
|
|
21
|
-
/^Fw:(.*)/m, // Outlook Live (cs, en, hr, hu, sk), Yahoo Mail (all locales)
|
|
22
|
-
/^VS:(.*)/m, // Outlook Live (da), New Outlook 2019 (da)
|
|
23
|
-
/^WG:(.*)/m, // Outlook Live (de), New Outlook 2019 (de)
|
|
24
|
-
/^RV:(.*)/m, // Outlook Live (es), New Outlook 2019 (es)
|
|
25
|
-
/^TR:(.*)/m, // Outlook Live (fr), New Outlook 2019 (fr)
|
|
26
|
-
/^I:(.*)/m, // Outlook Live (it), New Outlook 2019 (it)
|
|
27
|
-
/^FW:(.*)/m, // Outlook Live (nl, pt), New Outlook 2019 (cs, en, hu, nl, pt, ru, sk), Outlook 2019 (all locales)
|
|
28
|
-
/^Vs:(.*)/m, // Outlook Live (no)
|
|
29
|
-
/^PD:(.*)/m, // Outlook Live (pl), New Outlook 2019 (pl)
|
|
30
|
-
/^ENC:(.*)/m, // Outlook Live (pt-br), New Outlook 2019 (pt-br)
|
|
31
|
-
/^Redir.:(.*)/m, // Outlook Live (ro)
|
|
32
|
-
/^VB:(.*)/m, // Outlook Live (sv), New Outlook 2019 (sv)
|
|
21
|
+
/^Fw:(.*)/m, // Outlook Live / 365 (cs, en, hr, hu, sk), Yahoo Mail (all locales)
|
|
22
|
+
/^VS:(.*)/m, // Outlook Live / 365 (da), New Outlook 2019 (da)
|
|
23
|
+
/^WG:(.*)/m, // Outlook Live / 365 (de), New Outlook 2019 (de)
|
|
24
|
+
/^RV:(.*)/m, // Outlook Live / 365 (es), New Outlook 2019 (es)
|
|
25
|
+
/^TR:(.*)/m, // Outlook Live / 365 (fr), New Outlook 2019 (fr)
|
|
26
|
+
/^I:(.*)/m, // Outlook Live / 365 (it), New Outlook 2019 (it)
|
|
27
|
+
/^FW:(.*)/m, // Outlook Live / 365 (nl, pt), New Outlook 2019 (cs, en, hu, nl, pt, ru, sk), Outlook 2019 (all locales)
|
|
28
|
+
/^Vs:(.*)/m, // Outlook Live / 365 (no)
|
|
29
|
+
/^PD:(.*)/m, // Outlook Live / 365 (pl), New Outlook 2019 (pl)
|
|
30
|
+
/^ENC:(.*)/m, // Outlook Live / 365 (pt-br), New Outlook 2019 (pt-br)
|
|
31
|
+
/^Redir.:(.*)/m, // Outlook Live / 365 (ro)
|
|
32
|
+
/^VB:(.*)/m, // Outlook Live / 365 (sv), New Outlook 2019 (sv)
|
|
33
33
|
/^VL:(.*)/m, // New Outlook 2019 (fi)
|
|
34
34
|
/^Videresend:(.*)/m, // New Outlook 2019 (no)
|
|
35
35
|
/^İLT:(.*)/m, // New Outlook 2019 (tr)
|
|
36
|
-
/^Fwd:(.*)/m // Gmail (all locales), Thunderbird (all locales)
|
|
36
|
+
/^Fwd:(.*)/m // Gmail (all locales), Thunderbird (all locales), Missive (en)
|
|
37
37
|
],
|
|
38
38
|
|
|
39
39
|
separator : [
|
|
@@ -59,25 +59,25 @@ var REGEXES = {
|
|
|
59
59
|
/^>?\s*Vidarebefordrat mejl\s?:/m, // Apple Mail (sv)
|
|
60
60
|
/^>?\s*İleti başlangıcı\s?:/m, // Apple Mail (tr)
|
|
61
61
|
/^>?\s*Початок листа, що пересилається\s?:/m, // Apple Mail (uk)
|
|
62
|
-
/^\s*-{8,10}\s*Forwarded message\s*-{8,10}\s*/m, // Gmail (all locales)
|
|
63
|
-
/^\s*_{32}\s*$/m, // Outlook Live (all locales)
|
|
64
|
-
/^\s?Dne\s
|
|
65
|
-
/^\s?D.\s
|
|
66
|
-
/^\s?Am\s
|
|
67
|
-
/^\s?On\s
|
|
68
|
-
/^\s?El\s
|
|
69
|
-
/^\s?Le\s
|
|
70
|
-
/^\s
|
|
71
|
-
/^\s
|
|
72
|
-
/^\s?Il giorno\s
|
|
73
|
-
/^\s?Op\s
|
|
74
|
-
/^\s
|
|
75
|
-
/^\s?Dnia\s
|
|
76
|
-
/^\s?Em\s
|
|
77
|
-
/^\s
|
|
78
|
-
/^\s
|
|
79
|
-
/^\s?Den\s
|
|
80
|
-
/^\s?\"
|
|
62
|
+
/^\s*-{8,10}\s*Forwarded message\s*-{8,10}\s*/m, // Gmail (all locales), Missive (en)
|
|
63
|
+
/^\s*_{32}\s*$/m, // Outlook Live / 365 (all locales)
|
|
64
|
+
/^\s?Dne\s?.+\,\s?.+\s*[\[|<].+[\]|>]\s?napsal\(a\)\s?:/m, // Outlook 2019 (cz)
|
|
65
|
+
/^\s?D.\s?.+\s?skrev\s?\".+\"\s*[\[|<].+[\]|>]\s?:/m, // Outlook 2019 (da)
|
|
66
|
+
/^\s?Am\s?.+\s?schrieb\s?\".+\"\s*[\[|<].+[\]|>]\s?:/m, // Outlook 2019 (de)
|
|
67
|
+
/^\s?On\s?.+\,\s?\".+\"\s*[\[|<].+[\]|>]\s?wrote\s?:/m, // Outlook 2019 (en)
|
|
68
|
+
/^\s?El\s?.+\,\s?\".+\"\s*[\[|<].+[\]|>]\s?escribió\s?:/m, // Outlook 2019 (es)
|
|
69
|
+
/^\s?Le\s?.+\,\s?«.+»\s*[\[|<].+[\]|>]\s?a écrit\s?:/m, // Outlook 2019 (fr)
|
|
70
|
+
/^\s?.+\s*[\[|<].+[\]|>]\s?kirjoitti\s?.+\s?:/m, // Outlook 2019 (fi)
|
|
71
|
+
/^\s?.+\s?időpontban\s?.+\s*[\[|<|(].+[\]|>|)]\s?ezt írta\s?:/m, // Outlook 2019 (hu)
|
|
72
|
+
/^\s?Il giorno\s?.+\s?\".+\"\s*[\[|<].+[\]|>]\s?ha scritto\s?:/m, // Outlook 2019 (it)
|
|
73
|
+
/^\s?Op\s?.+\s?heeft\s?.+\s*[\[|<].+[\]|>]\s?geschreven\s?:/m, // Outlook 2019 (nl)
|
|
74
|
+
/^\s?.+\s*[\[|<].+[\]|>]\s?skrev følgende den\s?.+\s?:/m, // Outlook 2019 (no)
|
|
75
|
+
/^\s?Dnia\s?.+\s?„.+”\s*[\[|<].+[\]|>]\s?napisał\s?:/m, // Outlook 2019 (pl)
|
|
76
|
+
/^\s?Em\s?.+\,\s?\".+\"\s*[\[|<].+[\]|>]\s?escreveu\s?:/m, // Outlook 2019 (pt)
|
|
77
|
+
/^\s?.+\s?пользователь\s?\".+\"\s*[\[|<].+[\]|>]\s?написал\s?:/m, // Outlook 2019 (ru)
|
|
78
|
+
/^\s?.+\s?používateľ\s?.+\s*\([\[|<].+[\]|>]\)\s?napísal\s?:/m, // Outlook 2019 (sk)
|
|
79
|
+
/^\s?Den\s?.+\s?skrev\s?\".+\"\s*[\[|<].+[\]|>]\s?följande\s?:/m, // Outlook 2019 (sv)
|
|
80
|
+
/^\s?\".+\"\s*[\[|<].+[\]|>]\,\s?.+\s?tarihinde şunu yazdı\s?:/m, // Outlook 2019 (tr)
|
|
81
81
|
/\s*-{5,8} Přeposlaná zpráva -{5,8}\s*/m, // Yahoo Mail (cs), Thunderbird (cs)
|
|
82
82
|
/\s*-{5,8} Videresendt meddelelse -{5,8}\s*/m, // Yahoo Mail (da), Thunderbird (da)
|
|
83
83
|
/\s*-{5,8} Weitergeleitete Nachricht -{5,8}\s*/m, // Yahoo Mail (de), Thunderbird (de)
|
|
@@ -109,8 +109,28 @@ var REGEXES = {
|
|
|
109
109
|
/\s*-{8} Переслане повідомлення -{8}\s*/m // Thunderbird (uk)
|
|
110
110
|
],
|
|
111
111
|
|
|
112
|
+
separator_with_information : [
|
|
113
|
+
/^\s?Dne\s?(?<date>.+)\,\s?(?<from_name>.+)\s*[\[|<](?<from_address>.+)[\]|>]\s?napsal\(a\)\s?:/m, // Outlook 2019 (cz)
|
|
114
|
+
/^\s?D.\s?(?<date>.+)\s?skrev\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?:/m, // Outlook 2019 (da)
|
|
115
|
+
/^\s?Am\s?(?<date>.+)\s?schrieb\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?:/m, // Outlook 2019 (de)
|
|
116
|
+
/^\s?On\s?(?<date>.+)\,\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?wrote\s?:/m, // Outlook 2019 (en)
|
|
117
|
+
/^\s?El\s?(?<date>.+)\,\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?escribió\s?:/m, // Outlook 2019 (es)
|
|
118
|
+
/^\s?Le\s?(?<date>.+)\,\s?«(?<from_name>.+)»\s*[\[|<](?<from_address>.+)[\]|>]\s?a écrit\s?:/m, // Outlook 2019 (fr)
|
|
119
|
+
/^\s?(?<from_name>.+)\s*[\[|<](?<from_address>.+)[\]|>]\s?kirjoitti\s?(?<date>.+)\s?:/m, // Outlook 2019 (fi)
|
|
120
|
+
/^\s?(?<date>.+)\s?időpontban\s?(?<from_name>.+)\s*[\[|<|(](?<from_address>.+)[\]|>|)]\s?ezt írta\s?:/m, // Outlook 2019 (hu)
|
|
121
|
+
/^\s?Il giorno\s?(?<date>.+)\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?ha scritto\s?:/m, // Outlook 2019 (it)
|
|
122
|
+
/^\s?Op\s?(?<date>.+)\s?heeft\s?(?<from_name>.+)\s*[\[|<](?<from_address>.+)[\]|>]\s?geschreven\s?:/m, // Outlook 2019 (nl)
|
|
123
|
+
/^\s?(?<from_name>.+)\s*[\[|<](?<from_address>.+)[\]|>]\s?skrev følgende den\s?(?<date>.+)\s?:/m, // Outlook 2019 (no)
|
|
124
|
+
/^\s?Dnia\s?(?<date>.+)\s?„(?<from_name>.+)”\s*[\[|<](?<from_address>.+)[\]|>]\s?napisał\s?:/m, // Outlook 2019 (pl)
|
|
125
|
+
/^\s?Em\s?(?<date>.+)\,\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?escreveu\s?:/m, // Outlook 2019 (pt)
|
|
126
|
+
/^\s?(?<date>.+)\s?пользователь\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?написал\s?:/m, // Outlook 2019 (ru)
|
|
127
|
+
/^\s?(?<date>.+)\s?používateľ\s?(?<from_name>.+)\s*\([\[|<](?<from_address>.+)[\]|>]\)\s?napísal\s?:/m, // Outlook 2019 (sk)
|
|
128
|
+
/^\s?Den\s?(?<date>.+)\s?skrev\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?följande\s?:/m, // Outlook 2019 (sv)
|
|
129
|
+
/^\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\,\s?(?<date>.+)\s?tarihinde şunu yazdı\s?:/m // Outlook 2019 (tr)
|
|
130
|
+
],
|
|
131
|
+
|
|
112
132
|
original_subject : [
|
|
113
|
-
/^Subject\s?:(.+)/im, // Apple Mail (en), Gmail (all locales), Outlook Live (all locales), New Outlook 2019 (en), Thunderbird (da, en)
|
|
133
|
+
/^Subject\s?:(.+)/im, // Apple Mail (en), Gmail (all locales), Outlook Live / 365 (all locales), New Outlook 2019 (en), Thunderbird (da, en), Missive (en)
|
|
114
134
|
/^Předmět\s?:(.+)/im, // Apple Mail (cs), New Outlook 2019 (cs), Thunderbird (cs)
|
|
115
135
|
/^Emne\s?:(.+)/im, // Apple Mail (da, no), New Outlook 2019 (da), Thunderbird (no)
|
|
116
136
|
/^Betreff\s?:(.+)/im, // Apple Mail (de), New Outlook 2019 (de), Thunderbird (de)
|
|
@@ -152,7 +172,7 @@ var REGEXES = {
|
|
|
152
172
|
],
|
|
153
173
|
|
|
154
174
|
original_from : [
|
|
155
|
-
/^(\s*From\s?:(.+))$/m, // Apple Mail (en), Outlook Live (all locales), New Outlook 2019 (en), Thunderbird (da, en)
|
|
175
|
+
/^(\s*From\s?:(.+))$/m, // Apple Mail (en), Outlook Live / 365 (all locales), New Outlook 2019 (en), Thunderbird (da, en), Missive (en)
|
|
156
176
|
/^(\s*Od\s?:(.+))$/m, // Apple Mail (cs, pl, sk), Gmail (cs, pl, sk), New Outlook 2019 (cs, pl, sk), Thunderbird (cs, sk)
|
|
157
177
|
/^(\s*Fra\s?:(.+))$/m, // Apple Mail (da, no), Gmail (da, no), New Outlook 2019 (da), Thunderbird (no)
|
|
158
178
|
/^(\s*Von\s?:(.+))$/m, // Apple Mail (de), Gmail (de), New Outlook 2019 (de), Thunderbird (de)
|
|
@@ -195,7 +215,7 @@ var REGEXES = {
|
|
|
195
215
|
],
|
|
196
216
|
|
|
197
217
|
original_to : [
|
|
198
|
-
/^\s*To\s?:(.+)$/m, // Apple Mail (en), Gmail (all locales), Outlook Live (all locales), Thunderbird (da, en)
|
|
218
|
+
/^\s*To\s?:(.+)$/m, // Apple Mail (en), Gmail (all locales), Outlook Live / 365 (all locales), Thunderbird (da, en), Missive (en)
|
|
199
219
|
/^\s*Komu\s?:(.+)$/m, // Apple Mail (cs), New Outlook 2019 (cs, sk), Thunderbird (cs)
|
|
200
220
|
/^\s*Til\s?:(.+)$/m, // Apple Mail (da, no), New Outlook 2019 (da), Thunderbird (no)
|
|
201
221
|
/^\s*An\s?:(.+)$/m, // Apple Mail (de), New Outlook 2019 (de), Thunderbird (de)
|
|
@@ -258,7 +278,7 @@ var REGEXES = {
|
|
|
258
278
|
],
|
|
259
279
|
|
|
260
280
|
original_cc : [
|
|
261
|
-
/^\s*Cc\s?:(.+)$/m, // Apple Mail (en, da, es, fr, hr, it, pt, pt-br, ro, sk), Gmail (all locales), Outlook Live (all locales), New Outlook 2019 (da, de, en, fr, it, pt-br)
|
|
281
|
+
/^\s*Cc\s?:(.+)$/m, // Apple Mail (en, da, es, fr, hr, it, pt, pt-br, ro, sk), Gmail (all locales), Outlook Live / 365 (all locales), New Outlook 2019 (da, de, en, fr, it, pt-br), Missive (en)
|
|
262
282
|
/^\s*CC\s?:(.+)$/m, // New Outlook 2019 (es, nl, pt), Thunderbird (da, en, es, fi, hr, hu, it, nl, no, pt, pt-br, ro, tr, uk)
|
|
263
283
|
/^\s*Kopie\s?:(.+)$/m, // Apple Mail (cs, de, nl), New Outlook 2019 (cs), Thunderbird (cs)
|
|
264
284
|
/^\s*Kopio\s?:(.+)$/m, // Apple Mail (fi), New Outlook 2019 (es)
|
|
@@ -291,7 +311,7 @@ var REGEXES = {
|
|
|
291
311
|
],
|
|
292
312
|
|
|
293
313
|
original_date : [
|
|
294
|
-
/^\s*Date\s?:(.+)$/m, // Apple Mail (en, fr), Gmail (all locales), New Outlook 2019 (en, fr), Thunderbird (da, en, fr)
|
|
314
|
+
/^\s*Date\s?:(.+)$/m, // Apple Mail (en, fr), Gmail (all locales), New Outlook 2019 (en, fr), Thunderbird (da, en, fr), Missive (en)
|
|
295
315
|
/^\s*Datum\s?:(.+)$/m, // Apple Mail (cs, de, hr, nl, sv), New Outlook 2019 (cs, de, nl, sv), Thunderbird (cs, de, hr, nl, sv)
|
|
296
316
|
/^\s*Dato\s?:(.+)$/m, // Apple Mail (da, no), New Outlook 2019 (da), Thunderbird (no)
|
|
297
317
|
/^\s*Fecha\s?:(.+)$/m, // Apple Mail (es), New Outlook 2019 (es), Thunderbird (es)
|
|
@@ -301,7 +321,7 @@ var REGEXES = {
|
|
|
301
321
|
/^\s*Dată\s?:(.+)$/m, // Apple Mail (ro), Thunderbird (ro)
|
|
302
322
|
/^\s*Дата\s?:(.+)$/m, // Apple Mail (ru, uk), New Outlook 2019 (ru), Thunderbird (ru, uk)
|
|
303
323
|
/^\s*Tarih\s?:(.+)$/m, // Apple Mail (tr), Thunderbird (tr)
|
|
304
|
-
/^\s*Sent\s?:(.+)$/m, // Outlook Live (all locales)
|
|
324
|
+
/^\s*Sent\s?:(.+)$/m, // Outlook Live / 365 (all locales)
|
|
305
325
|
/^\s*Päiväys\s?:(.+)$/m // Thunderbird (fi)
|
|
306
326
|
],
|
|
307
327
|
|
|
@@ -326,6 +346,8 @@ var REGEXES = {
|
|
|
326
346
|
],
|
|
327
347
|
|
|
328
348
|
mailbox : [
|
|
349
|
+
/^\s?\n?\s*<.+?<mailto\:(.+?)>>/, // "<walter.sheltan@acme.com<mailto:walter.sheltan@acme.com>>"
|
|
350
|
+
/^(.+?)\s?\n?\s*<.+?<mailto\:(.+?)>>/, // "Walter Sheltan <walter.sheltan@acme.com<mailto:walter.sheltan@acme.com>>"
|
|
329
351
|
/^(.+?)\s?\n?\s*[\[|<]mailto\:(.+?)[\]|>]/, // "Walter Sheltan <mailto:walter.sheltan@acme.com>" or "Walter Sheltan [mailto:walter.sheltan@acme.com]" or "walter.sheltan@acme.com <mailto:walter.sheltan@acme.com>"
|
|
330
352
|
/^\'(.+?)\'\s?\n?\s*[\[|<](.+?)[\]|>]/, // "'Walter Sheltan' <walter.sheltan@acme.com>" or "'Walter Sheltan' [walter.sheltan@acme.com]" or "'walter.sheltan@acme.com' <walter.sheltan@acme.com>"
|
|
331
353
|
/^\"\'(.+?)\'\"\s?\n?\s*[\[|<](.+?)[\]|>]/, // ""'Walter Sheltan'" <walter.sheltan@acme.com>" or ""'Walter Sheltan'" [walter.sheltan@acme.com]" or ""'walter.sheltan@acme.com'" <walter.sheltan@acme.com>"
|
|
@@ -384,8 +406,8 @@ class Parser {
|
|
|
384
406
|
// Remove Byte Order Mark
|
|
385
407
|
_body = _body.replace(this.__regexes.byte_order_mark, "");
|
|
386
408
|
|
|
387
|
-
// First method: split via the separator (Apple Mail, Gmail,
|
|
388
|
-
// Outlook 2019, Yahoo Mail, Thunderbird)
|
|
409
|
+
// First method: split via the separator (Apple Mail, Gmail, \
|
|
410
|
+
// Outlook Live / 365, Outlook 2019, Yahoo Mail, Thunderbird)
|
|
389
411
|
var _match = loopRegexes(this.__regexes.separator, _body, "split");
|
|
390
412
|
|
|
391
413
|
if (_match && _match.length > 1) {
|
|
@@ -393,7 +415,7 @@ class Parser {
|
|
|
393
415
|
body : _body,
|
|
394
416
|
|
|
395
417
|
message : trimString(_match[0]),
|
|
396
|
-
email : trimString(_match[
|
|
418
|
+
email : trimString(_match[1])
|
|
397
419
|
};
|
|
398
420
|
}
|
|
399
421
|
|
|
@@ -488,7 +510,7 @@ class Parser {
|
|
|
488
510
|
var _match = null;
|
|
489
511
|
|
|
490
512
|
// First method: extract the text after the Cc, To or Reply-To part \
|
|
491
|
-
// (Apple Mail, Gmail) or after the Subject part (Outlook Live)
|
|
513
|
+
// (Apple Mail, Gmail) or after the Subject part (Outlook Live / 365)
|
|
492
514
|
var _regexes = [
|
|
493
515
|
this.__regexes.original_subject,
|
|
494
516
|
this.__regexes.original_cc,
|
|
@@ -540,7 +562,7 @@ class Parser {
|
|
|
540
562
|
var _name = null;
|
|
541
563
|
|
|
542
564
|
// First method: extract the author via the From part (Apple Mail, Gmail, \
|
|
543
|
-
// Outlook Live, New Outlook 2019, Thunderbird)
|
|
565
|
+
// Outlook Live / 365, New Outlook 2019, Thunderbird)
|
|
544
566
|
var _author = this.__parseMailbox(this.__regexes.original_from, text);
|
|
545
567
|
|
|
546
568
|
// Author found?
|
|
@@ -548,8 +570,13 @@ class Parser {
|
|
|
548
570
|
return _author;
|
|
549
571
|
}
|
|
550
572
|
|
|
573
|
+
// Multiple authors found?
|
|
574
|
+
if (Array.isArray(_author) && _author[0].address) {
|
|
575
|
+
return _author[0];
|
|
576
|
+
}
|
|
577
|
+
|
|
551
578
|
// Second method: extract the author via the separator (Outlook 2019)
|
|
552
|
-
var _match = loopRegexes(this.__regexes.
|
|
579
|
+
var _match = loopRegexes(this.__regexes.separator_with_information, body);
|
|
553
580
|
|
|
554
581
|
if (_match && _match.length === 4 && _match.groups) {
|
|
555
582
|
// Notice: the order of parts may change depending on the localization, \
|
|
@@ -598,7 +625,7 @@ class Parser {
|
|
|
598
625
|
*/
|
|
599
626
|
__parseOriginalTo(text) {
|
|
600
627
|
// First method: extract the primary recipient(s) via the To part \
|
|
601
|
-
// (Apple Mail, Gmail, Outlook Live, New Outlook 2019, Thunderbird)
|
|
628
|
+
// (Apple Mail, Gmail, Outlook Live / 365, New Outlook 2019, Thunderbird)
|
|
602
629
|
var _recipients = this.__parseMailbox(
|
|
603
630
|
this.__regexes.original_to,
|
|
604
631
|
|
|
@@ -654,7 +681,7 @@ class Parser {
|
|
|
654
681
|
*/
|
|
655
682
|
__parseOriginalCc(text) {
|
|
656
683
|
// First method: extract the carbon-copy recipient(s) via the Cc part \
|
|
657
|
-
// (Apple Mail, Gmail, Outlook Live, New Outlook 2019, Thunderbird)
|
|
684
|
+
// (Apple Mail, Gmail, Outlook Live / 365, New Outlook 2019, Thunderbird)
|
|
658
685
|
var _recipients = this.__parseMailbox(
|
|
659
686
|
this.__regexes.original_cc,
|
|
660
687
|
|
|
@@ -795,7 +822,7 @@ class Parser {
|
|
|
795
822
|
*/
|
|
796
823
|
__parseOriginalSubject(text) {
|
|
797
824
|
// First method: extract the subject via the Subject part (Apple Mail, \
|
|
798
|
-
// Gmail, Outlook Live, New Outlook 2019, Thunderbird)
|
|
825
|
+
// Gmail, Outlook Live / 365, New Outlook 2019, Thunderbird)
|
|
799
826
|
var _match = loopRegexes(this.__regexes.original_subject, text);
|
|
800
827
|
|
|
801
828
|
if (_match && _match.length > 0) {
|
|
@@ -823,7 +850,7 @@ class Parser {
|
|
|
823
850
|
*/
|
|
824
851
|
__parseOriginalDate(text, body) {
|
|
825
852
|
// First method: extract the date via the Date part (Apple Mail, Gmail, \
|
|
826
|
-
// Outlook Live, New Outlook 2019, Thunderbird)
|
|
853
|
+
// Outlook Live / 365, New Outlook 2019, Thunderbird)
|
|
827
854
|
var _match = loopRegexes(this.__regexes.original_date, text);
|
|
828
855
|
|
|
829
856
|
if (_match && _match.length > 0) {
|
|
@@ -831,7 +858,7 @@ class Parser {
|
|
|
831
858
|
}
|
|
832
859
|
|
|
833
860
|
// Second method: extract the date via the separator (Outlook 2019)
|
|
834
|
-
_match = loopRegexes(this.__regexes.
|
|
861
|
+
_match = loopRegexes(this.__regexes.separator_with_information, body);
|
|
835
862
|
|
|
836
863
|
if (_match && _match.length === 4 && _match.groups) {
|
|
837
864
|
// Notice: the order of parts may change depending on the localization, \
|