email-bounce-parser 1.0.20 → 1.0.22
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 +18 -14
- package/package.json +1 -1
package/lib/parser.js
CHANGED
|
@@ -35,11 +35,13 @@ var ERROR_CODES_TYPES = {
|
|
|
35
35
|
"550 5.1.1" : "no_such_recipient",
|
|
36
36
|
"550 5.2.1" : "recipient_disabled_or_recipient_rate_limited",
|
|
37
37
|
"550 5.7.1" : "spam_content",
|
|
38
|
+
"550 5.7.26" : "authentication_failure",
|
|
38
39
|
"551" : "user_not_local",
|
|
39
40
|
"552" : "action_aborted_exceeded_storage_allocation",
|
|
40
41
|
"552 5.2.2" : "mailbox_over_quota",
|
|
41
42
|
"552 5.2.3" : "message_size_limit",
|
|
42
43
|
"553" : "action_not_taken_mailbox_name_not_allowed",
|
|
44
|
+
"553 5.1.2" : "no_such_recipient",
|
|
43
45
|
"554" : "transaction_failed",
|
|
44
46
|
"554 5.7.1" : "spam_content",
|
|
45
47
|
"555" : "parameters_not_recognized",
|
|
@@ -78,19 +80,20 @@ var REGEXES = {
|
|
|
78
80
|
/Message rejected by\:\s+([\S\.]+?)$/m, // Outlook error
|
|
79
81
|
/from (\S+) \[([\d\.]+)\](?:\:(\d+)\:)?/m,
|
|
80
82
|
/conversation with (\S+)\[([\d\.]+)\](?:\:(\d+)\:)? timed out/m,
|
|
83
|
+
/lost connection with (\S+)\[([\d\.]+)\](?:\:(\d+)\:)?/m, // "lost connection with mx.mail-data.net[134.244.220.69]"
|
|
81
84
|
/Generating server: (\S+)(?:\[([\d\.]+)\])?(?:\:(\d+)\:)?/m // "Generating server: PH7PR02MB9549495.namprd02.prod.outlook.com"
|
|
82
85
|
],
|
|
83
86
|
|
|
84
87
|
error : [
|
|
85
|
-
/said\: (\d{3}(?:[\s
|
|
86
|
-
/said\: (\d{3}(?:[\s
|
|
88
|
+
/said\: (\d{3}(?:[\s\-\#\']{1,2}\d\.\d\.\d{1,3})?) (.+) \(in reply to/,
|
|
89
|
+
/said\: (\d{3}(?:[\s\-\#\']{1,2}\d\.\d\.\d{1,3})?)-(.+)/,
|
|
87
90
|
/(\d{3}\-\'\d\.\d\.\d{1,3}) (.+)/,
|
|
88
|
-
/LMTP error after .+?\:\<.+?\>\: (\d{3}(?:[\s
|
|
89
|
-
/remote server returned \'(\d{3}(?:[\s
|
|
90
|
-
/The response from the remote server was:\s(\d{3}(?:[\s
|
|
91
|
-
/refused to talk to me\: (\d{3}(?:[\s
|
|
92
|
-
/(?:error|reason)\:\s*?(\d{3}(?:[\s
|
|
93
|
-
/(\d{3}[\s
|
|
91
|
+
/LMTP error after .+?\:\<.+?\>\: (\d{3}(?:[\s\-\#\']{1,2}\d\.\d\.\d{1,3})?) <.+?\>(.+)$/m,
|
|
92
|
+
/remote server returned \'(\d{3}(?:[\s\-\#\']{1,2}\d\.\d\.\d{1,3})?) (.+)\'/i,
|
|
93
|
+
/The response from the remote server was:\s(\d{3}(?:[\s\-\#\']{1,2}\d\.\d\.\d{1,3})?) (.+)/,
|
|
94
|
+
/refused to talk to me\: (\d{3}(?:[\s\-\#\']{1,2}\d\.\d\.\d{1,3})?) (.+)/,
|
|
95
|
+
/(?:error|reason)\:\s*?(\d{3}(?:[\s\-\#\']{1,2}\d\.\d\.\d{1,3})?) (.+)/i,
|
|
96
|
+
/(\d{3}[\s\-\#\']{1,2}\d\.\d\.\d{1,3})/,
|
|
94
97
|
/(\d{3}\-\'\d\.\d\.\d{1,3})/
|
|
95
98
|
],
|
|
96
99
|
|
|
@@ -110,7 +113,7 @@ var REGEXES = {
|
|
|
110
113
|
|
|
111
114
|
recipient : [
|
|
112
115
|
/the following addresses had permanent fatal errors (?:.*?)\s\<(.+?)\>/i,
|
|
113
|
-
/there was a temporary problem delivering your message to (.+?). Gmail will retry/i,
|
|
116
|
+
/there was a temporary problem (?:while )?delivering your message to (.+?). Gmail will retry/i,
|
|
114
117
|
/the following message to \<(.+?)\> was undeliverable/i,
|
|
115
118
|
/to the following addresses:\s*(.+)/i,
|
|
116
119
|
/^your message wasn't delivered to (.+?)\s/mi, // "Your message wasn't delivered to john@acme.com"
|
|
@@ -122,8 +125,8 @@ var REGEXES = {
|
|
|
122
125
|
],
|
|
123
126
|
|
|
124
127
|
temporary_safe : /(temporary|temporarily)/i,
|
|
125
|
-
blocked : /((?:is listed)|blocked|banned|denied|dnsbl)/i,
|
|
126
|
-
spam : /(spam)/i,
|
|
128
|
+
blocked : /((?:is listed)|blocked|block list|banned|denied|dnsbl)/i,
|
|
129
|
+
spam : /(spam|unsolicited)/i,
|
|
127
130
|
|
|
128
131
|
enhanced_types : {
|
|
129
132
|
no_such_recipient : [
|
|
@@ -150,13 +153,13 @@ var REGEXES = {
|
|
|
150
153
|
],
|
|
151
154
|
|
|
152
155
|
reputation : [
|
|
153
|
-
/(rate limited due to IP reputation)/i
|
|
156
|
+
/(rate limited due to IP reputation)/i,
|
|
157
|
+
/(new or untrusted IP)/i
|
|
154
158
|
]
|
|
155
159
|
},
|
|
156
160
|
|
|
157
161
|
error_code : [
|
|
158
|
-
/(\d{3})[\s
|
|
159
|
-
/(\d{3})\-\'(\d\.\d\.\d{1,3})/, // "550-'5.4.1" or "550-'5.4.11" or "550-'5.4.110"
|
|
162
|
+
/(\d{3})[\s\-\#\']{1,2}(\d\.\d\.\d{1,3})/, // "550 5.4.1" or "550 #5.4.1" or "550-5.4.1" or "550-'5.4.1"
|
|
160
163
|
/(\d{3})/ // "550"
|
|
161
164
|
]
|
|
162
165
|
};
|
|
@@ -552,6 +555,7 @@ class Parser {
|
|
|
552
555
|
_str = _str.replace(this.__regexes.line_break_double_indent_single, "\n\n");
|
|
553
556
|
|
|
554
557
|
// Replace single Line-break with regular space
|
|
558
|
+
// TODO: re2 doesn't support lookbehinds, so for now we use a pure-JS regex
|
|
555
559
|
_str = _str.replace(/(?<!\n)\n(?!\n)/gm, " ");
|
|
556
560
|
|
|
557
561
|
// Replace long indent with double Line-break
|