email-bounce-parser 1.0.3 → 1.0.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.
Files changed (2) hide show
  1. package/lib/parser.js +14 -2
  2. package/package.json +1 -1
package/lib/parser.js CHANGED
@@ -77,6 +77,10 @@ var REGEXES = {
77
77
  blocked : /((?:is listed)blocked|banned|denied|dnsbl)/i,
78
78
  spam : /(spam)/i,
79
79
 
80
+ enhanced_types_no_such_recipient : [
81
+ /((?:user is terminated)|(?:invalid mailbox)|(?:account is disabled)|(?:user not found))/i
82
+ ],
83
+
80
84
  error_code : [
81
85
  /(\d{3})[\s\-](\d\.\d\.\d)/,
82
86
  /(\d{3})/
@@ -302,8 +306,16 @@ class Parser {
302
306
  _blocked = false,
303
307
  _spam = false;
304
308
 
305
- if (code.basic && code.enhanced) {
306
- _type = ERROR_CODES_TYPES[`${code.basic} ${code.enhanced}`] || null;
309
+ if (code.basic) {
310
+ if (code.enhanced) {
311
+ _type = ERROR_CODES_TYPES[`${code.basic} ${code.enhanced}`] || null;
312
+ } else {
313
+ var _match = loopRegexes(this.__regexes.enhanced_types_no_such_recipient, str);
314
+
315
+ if (_match && _match.length > 1) {
316
+ _type = "no_such_recipient";
317
+ }
318
+ }
307
319
  }
308
320
 
309
321
  // Check if blocked
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "email-bounce-parser",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Parses bounce emails and extract errors",
5
5
  "author": "Eliott Vincent <eliott@crisp.chat>",
6
6
  "main": "lib/index.js",