email-bounce-parser 1.0.14 → 1.0.15

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 +20 -17
  2. package/package.json +1 -1
package/lib/parser.js CHANGED
@@ -61,33 +61,36 @@ var REGEXES = {
61
61
  ],
62
62
 
63
63
  command : [
64
- /\(in reply to end of ([A-Z\s]+) command\)$/m, // 'end of' command
65
- /\(in reply to ([A-Z\s]+) command\)$/m, // default
66
- /timed out while sending ([A-Z\s]+)$/m, // command timed out
67
- /error after ([A-Z\s]+)/m // 'after' command
64
+ /\(in reply to end of ([A-Z\s]+) command\)$/m, // "in reply to end of DATA command"
65
+ /\(in reply to ([A-Z\s]+) command\)$/m, // "in reply to RCPT TO command"
66
+ /timed out while sending ([A-Z\s]+)$/m, // "timed out while sending (RCPT TO)", "timed out while sending RCPT TO"
67
+ /error after ([A-Z\s]+)/m, // "LMTP error after RCPT TO"
68
+ /while sending end of ([a-z\s]+)/m // "while sending end of data"
68
69
  ],
69
70
 
70
71
  email_server : [
71
72
  /host (\S+)\[([\d\.]+)\](?:\:(\d+)\:)? (?:said|refused to talk)/m,
72
73
  /^(\S+) rejected your message/m,
73
- /\: connect to (.+)\[(.+)\](?:\:(\d+)\:)?/m,
74
+ /\: connect to (.+)\[(.+)\](?:\:(\d+)\:)?/m, // "connect to acme.com[132.145.223.95]:25:"
74
75
  /Name service error for name\=(\S+)\s/m,
75
76
  /RCPT TO\:\<(.+?)\>/m,
76
77
  /Message rejected by\:\s+([\S\.]+?)$/m, // Outlook error
77
- /from (\S+) \[([\d\.]+)\](?:\:(\d+)\:)?/m
78
+ /from (\S+) \[([\d\.]+)\](?:\:(\d+)\:)?/m,
79
+ /conversation with (\S+)\[([\d\.]+)\](?:\:(\d+)\:)? timed out/m,
80
+ /Generating server: (\S+)(?:\[([\d\.]+)\])?(?:\:(\d+)\:)?/m // "Generating server: PH7PR02MB9549495.namprd02.prod.outlook.com"
78
81
  ],
79
82
 
80
83
  error : [
81
- /said\: (\d{3}(?:[\s\-]\d\.\d\.\d\d?)?) (.+) \(in reply to/m,
82
- /said\: (\d{3}(?:[\s\-]\d\.\d\.\d\d?)?)-(.+)/m,
83
- /(\d{3}\-\'\d\.\d\.\d\d?) (.+)/m,
84
+ /said\: (\d{3}(?:[\s\-]\d\.\d\.\d\d?)?) (.+) \(in reply to/,
85
+ /said\: (\d{3}(?:[\s\-]\d\.\d\.\d\d?)?)-(.+)/,
86
+ /(\d{3}\-\'\d\.\d\.\d\d?) (.+)/,
84
87
  /LMTP error after (?:.+?)\:\<.+?\>\: (\d{3}(?:[\s\-]\d\.\d\.\d\d?)?) <.+?\>(.+)$/m,
85
- /Remote Server returned \'(\d{3}(?:[\s\-]\d\.\d\.\d\d?)?) (.+)\'/m,
86
- /The response from the remote server was:\s(\d{3}(?:[\s\-]\d\.\d\.\d\d?)?) (.+)/m,
87
- /refused to talk to me\: (\d{3}(?:[\s\-]\d\.\d\.\d\d?)?) (.+)/m,
88
- /(?:error|reason)\:\s*?(\d{3}(?:[\s\-]\d\.\d\.\d\d?)?) (.+)/mi,
89
- /(\d{3}[\s\-]\d\.\d\.\d\d?)/m,
90
- /(\d{3}\-\'\d\.\d\.\d\d?)/m
88
+ /remote server returned \'(\d{3}(?:[\s\-]\d\.\d\.\d\d?)?) (.+)\'/i,
89
+ /The response from the remote server was:\s(\d{3}(?:[\s\-]\d\.\d\.\d\d?)?) (.+)/,
90
+ /refused to talk to me\: (\d{3}(?:[\s\-]\d\.\d\.\d\d?)?) (.+)/,
91
+ /(?:error|reason)\:\s*?(\d{3}(?:[\s\-]\d\.\d\.\d\d?)?) (.+)/i,
92
+ /(\d{3}[\s\-]\d\.\d\.\d\d?)/,
93
+ /(\d{3}\-\'\d\.\d\.\d\d?)/
91
94
  ],
92
95
 
93
96
  error_lax : [
@@ -127,7 +130,7 @@ var REGEXES = {
127
130
  ],
128
131
 
129
132
  enhanced_types_mailbox_full : [
130
- /(out of storage|(?:mailbox (?:is )?full)|(?:user (?:is )?over quota))/i
133
+ /(out of storage|(?:mailbox (?:is )?full)|(?:user (?:is )?over quota))/i // "user is over quota" (iCloud)
131
134
  ],
132
135
 
133
136
  error_code : [
@@ -494,7 +497,7 @@ class Parser {
494
497
  var _match = loopRegexes(this.__regexes.command, str);
495
498
 
496
499
  if (_match && _match.length > 1) {
497
- _command = _match[1];
500
+ _command = trimString(_match[1]).toUpperCase();
498
501
  }
499
502
 
500
503
  return _command;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "email-bounce-parser",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "Parses bounce emails and extract errors",
5
5
  "author": "Eliott Vincent <eliott@crisp.chat>",
6
6
  "main": "lib/index.js",