email-forward-parser 1.0.13 → 1.0.14

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/parser.js CHANGED
@@ -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)
33
- /^VL:(.+)/m, // New Outlook 2019 (fi)
34
- /^Videresend:(.+)/m, // New Outlook 2019 (no)
35
- /^İLT:(.+)/m, // New Outlook 2019 (tr)
36
- /^Fwd:(.+)/m // Gmail (all locales), Thunderbird (all locales)
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)
33
+ /^VL:(.*)/m, // New Outlook 2019 (fi)
34
+ /^Videresend:(.*)/m, // New Outlook 2019 (no)
35
+ /^İLT:(.*)/m, // New Outlook 2019 (tr)
36
+ /^Fwd:(.*)/m // Gmail (all locales), Thunderbird (all locales)
37
37
  ],
38
38
 
39
39
  separator : [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "email-forward-parser",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Parses forwarded emails and extract content",
5
5
  "author": "Eliott Vincent <eliott@crisp.chat>",
6
6
  "main": "lib/index.js",
package/test.js ADDED
@@ -0,0 +1,25 @@
1
+ const EmailForwardParser = require("./");
2
+ const fs = require("fs");
3
+
4
+ MY_EMAIL_STRING = fs.readFileSync("./test.txt", "utf-8");
5
+ // MY_EMAIL_STRING = fs.readFileSync("./test_working.txt", "utf-8");
6
+ // const result = new EmailForwardParser().read(MY_EMAIL_STRING, "FW: FC-701 Contact Request by Gleam.io");
7
+ const result = new EmailForwardParser().read(MY_EMAIL_STRING, "Fwd:");
8
+
9
+ console.log(result.forwarded);
10
+ console.log(result);
11
+ // console.log(result.email.to);
12
+ // console.log(result.email.cc);
13
+
14
+ // {
15
+ // forwarded: false,
16
+ // message: null,
17
+ // email: {
18
+ // body: undefined,
19
+ // from: { address: undefined, name: undefined },
20
+ // to: undefined,
21
+ // cc: undefined,
22
+ // subject: undefined,
23
+ // date: undefined
24
+ // }
25
+ // }
package/test.txt ADDED
@@ -0,0 +1,14 @@
1
+
2
+ Camille Le Bruchec
3
+ Head of Customer Success - Crisp
4
+ https://calendly.com/camille-crisp/30min-1
5
+ camille@crisp.chat
6
+
7
+ > Début du message réexpédié :
8
+ >
9
+ > De: Camille Le Bruchec <camille.lebruchec@icloud.com>
10
+ > Date: 19 avril 2022 à 16:38:24 UTC+2
11
+ > À: Camille Le Bruchec <camille@crisp.chat>
12
+ >
13
+ >
14
+ > Hello test 4