Branch Coverage

blib/lib/Mail/DeliveryStatus/BounceParser.pm
Criterion Covered Total %
branch 208 270 77.0


line true false branch
122 0 132 if (not $data) { }
132 0 elsif (not ref $data) { }
0 0 elsif (ref $data eq 'ARRAY') { }
123 0 0 if -t STDIN
142 132 0 defined $message->effective_type ? :
131 1 defined $message->head->get('subject') ? :
152 6 654 if (my $newmessage = $self->$preprocessor($message))
159 131 1 defined $message->head->get('subject') ? :
170 132 0 unless $message->head->get('x-delivery-agent') and $message->head->get('X-Delivery-Agent') =~ /^TMDA/
179 131 1 unless $message->head->get('X-Bluebottle-Request') and $first_part->stringify_body =~ /This account is protected by Bluebottle/
187 130 1 unless defined $first_part and $first_part->stringify_body =~ /Your server requires confirmation/
195 129 1 unless defined $first_part and $first_part->stringify_body =~ /Please add yourself to my Boxbe Guest List/
202 129 1 unless defined $first_part and $first_part->stringify_body =~ /This\s+is\s+a\s+one-time\s+automated\s+message\s+to\s+confirm\s+that\s+you're\s+listed\s+on\s+my\s+Boxbe\s+Guest\s+List/
219 111 19 if $message->effective_type eq 'multipart/report'
220 2 17 if not $first_part or $first_part->effective_type ne 'text/plain'
222 3 14 if length $string > 3000
224 13 1 unless $string =~ /auto.{0,20}(reply|response)|return receipt|vacation|(out|away|on holiday).*office/i
233 111 18 if $message->effective_type eq 'multipart/report'
234 2 16 if not $first_part or $first_part->effective_type ne 'text/plain'
236 1 15 unless defined $subject
237 14 1 unless $subject =~ /^AUTO/
238 0 1 unless $subject =~ /is out of the office/
247 111 17 if $message->effective_type eq 'multipart/report'
248 2 15 if not $first_part or $first_part->effective_type ne 'text/plain'
250 1 14 unless defined $subject
251 13 1 unless $subject =~ /Automatyczna\s+odpowied/
260 111 16 if $message->effective_type eq 'multipart/report'
261 2 14 if not $first_part or $first_part->effective_type ne 'text/plain'
263 2 12 if length $string > 3000
264 12 0 unless $string =~ /(address .{0,60} changed | domain .{0,40} retired) .* (has\s*been|was|have|will\s*be) \s* (forwarded|delivered)/six
276 0 10 if ($message->effective_type eq 'text/plain' and length $message->as_string < 3000 and $message->bodyhandle->as_string =~ /norton\sassociates\swebshield|content\s+filter/xi)
289 0 127 if ($message->effective_type eq 'text/plain' and $message->bodyhandle->as_string =~ /transient.*error/is)
306 10 117 if $message->effective_type eq 'text/plain'
309 5 122 if $message->effective_type =~ /multipart/ and $message->effective_type ne 'multipart/report'
313 13 114 if ($part_for_maybe_transient)
316 12 1 unless defined $transient_pos
319 1 0 if _position_before($permanent_pos, $orig_msg_pos)
320 0 0 if (_position_before($transient_pos, $orig_msg_pos))
329 116 11 if ($message->effective_type =~ /multipart/)
332 95 21 if (my($orig_message) = grep({$_->effective_type eq 'message/rfc822';} $message->parts))
338 94 1 if ($orig_message_id) { }
352 16 100 if (not $self->{'orig_message_id'} and my($rfc822_headers) = grep({lc $_->effective_type eq 'text/rfc822-headers';} $message->parts))
359 15 1 if ($message_id)
367 18 109 unless ($self->{'orig_message_id'})
368 5 13 if ($message->bodyhandle and $message->bodyhandle->as_string =~ /Message-ID: (\S+)/i)
374 13 114 unless ($self->{'orig_message_id'})
383 111 16 if ($message->effective_type eq 'multipart/report') { }
5 11 elsif ($message->effective_type =~ /multipart/) { }
10 1 elsif ($message->effective_type =~ m[text/plain]) { }
421 113 22 if (defined $report->get('Action') and lc $report->get('Action'))
424 113 0 if ($action =~ s/^\s*([a-z]+)\b.*/$1/s)
429 0 113 if ($action eq 'expanded') { }
112 1 elsif ($action eq 'failed') { }
444 268 0 if (defined $val)
451 2 132 if ($self->{'prefer_final_recipient'}) { }
459 22 112 unless $email
467 112 0 if (defined $reason)
474 112 0 if (defined $reason) { }
481 0 112 if $status =~ s/ \(permanent failure\)$//
483 112 0 if ($status) { }
487 9 103 if ($status =~ /^5\.1\.[01]$/) { }
1 102 elsif ($status eq '5.1.2') { }
2 100 elsif ($status eq '5.2.1') { }
1 99 elsif ($status eq '5.2.2') { }
1 98 elsif ($status eq '5.4.4') { }
510 112 0 if (defined $diag_code)
514 13 99 if $host
518 112 0 if (defined $diag_code)
523 13 0 if (not $code and $status and $status =~ /\A([245])\.?([0-9])\.?([0-9])/)
527 112 0 if ($code)
531 99 13 unless ($report->get('host'))
533 99 0 if (defined $email)
535 98 1 if $host
539 1 111 if ($report->get('smtp_code') and $report->get('smtp_code') =~ /^2../)
548 112 0 unless ($arg->{'report_non_bounces'})
549 0 112 if ($report->get('std_reason') eq 'no_problemo')
562 0 110 if ($seen_action_expanded and not $seen_action_failed)
575 3 6 if $_->effective_type =~ m[text/plain]
598 5 5 if ($body_string =~ /$Returned_Message_Below/) { }
0 5 elsif ($body_string =~ /(.+)\n\n(.+?Message-ID:.+)/is) { }
628 0 415 if (ref $self->{'log'} eq 'CODE')
638 0 15 if (@_ > 1)
642 3 12 if ref $text
658 2 13 unless $text
664 26 13 if $i % 2 == 0
668 0 13 if ($split[$i - 1] =~ /they are not accepting mail from/)
673 1 12 if ($split[$i - 1] =~ /A message sent by/)
679 12 0 if $#split > $i
680 6 6 if $std_reason eq 'unknown'
689 0 1 if exists $by_email{$email} and $by_email{$email}{'std_reason'} ne 'unknown' and $std_reason eq 'unknown'
930 0 116 unless (defined $_)
934 1 115 if (/(?:domain|host|service)\s+(?:not\s+found|unknown|not\s+known)/i)
938 1 114 if (/sorry,\s+that\s+domain\s+isn't\s+in\s+my\s+list\s+of\s+allowed\s+rcpthosts/i)
942 2 108 if (/try.again.later/is or /mailbox\b.*\bfull/ or /storage/i or /quota/i or /\s552\s/ or /\s#?5\.2\.2\s/ or /User\s+mailbox\s+exceeds\s+allowed\s+size/i or /Mailbox\s+size\s+limit\s+exceeded/i or /max\s+message\s+size\s+exceeded/i or /Benutzer\s+hat\s+zuviele\s+Mails\s+auf\s+dem\s+Server/i or /exceeded\s+its\s+disk\s+space\s+limit/i)
962 2 78 if (/\s \(? \#? 5\.1\.[01] \)? \s/x or /$user_re\s+(?:\S+\s+)? (?:is\s+)? # Generic (?: (?: un|not\s+) (?: known | recognized ) | [dw]oes\s?n[o']?t (?: exist|found ) | disabled | expired ) /xi or /no\s+(?:such)\s+?$user_re/i or /unrouteable address/i or /inactive user/i or /unknown local part/i or /user\s+doesn't\s+have\s+a/i or /account\s+has\s+been\s+(?:disabled|suspended)/i or /$user_re\s+(?:suspended|discontinued)/i or /unknown\s+$user_re/i or /$user_re\s+(?:is\s+)?(?:inactive|unavailable)/i or /(?:(?:in|not\s+a\s+)?valid|no such)\s$user_re/i or /$user_re\s+(?:was\s+)?not\s+found/i or /$user_re \s+ (?:is\s+)? (?:currently\s+)? # ATT, generic (?:suspended|unavailable)/xi or /address is administratively disabled/i or /no $user_re\s+(?:here\s+)?by that name/i or /? is invalid/i or /address.*not known here/i or /recipient\s+(?:address\s+)?rejected/i or /not\s+listed\s+in\s+Domino/i or /account not activated/i or /not\s+our\s+customer/i or /doesn't handle mail for that user/i or /$user_re\s+does\s+not\s+exist/i or /Recipient\s+?\s+does\s+not\s+exist/i or /recipient\s+no\s+longer\s+on\s+server/i or /is\s+not\s+a\s+known\s+user\s+on\s+this\s+system/i or /Rcpt\s+?\s+does\s+not\s+exist/i or /Mailbox\s+not\s+available/i or /No\s+mailbox\s+found/i or /?\s+is\s+a\s+deactivated\s+mailbox/i or /Recipient\s+does\s+not\s+exist\s+on\s+this\s+system/i or /user\s+mail-box\s+not\s+found/i or /No\s+mail\s+box\s+available\s+for\s+this\s+user/i or /User\s+\[\S+\]\s+does\s+not\s+exist/i or /email\s+account\s+that\s+you\s+tried\s+to\s+reach\s+is\s+disabled/i or /not\s+an\s+active\s+address\s+at\s+this\s+host/i or /not\s+a\s+known\s+user/i or /BAD_RECIPIENT/i)
1010 2 70 if (/domain\s+syntax/i or /timed\s+out/i or /route\s+to\s+host/i or /connection\s+refused/i or /no\s+data\s+record\s+of\s+requested\s+type/i or /Malformed name server reply/i or /as\s+a\s+relay,\s+but\s+I\s+have\s+not\s+been\s+configured\s+to\s+let/i or /550\s+relay\s+not\s+permitted/i or /550\s+relaying\s+denied/i or /Relay\s+access\s+denied/i or /Relaying\s+denied/i or /No\s+such\s+domain\s+at\s+this\s+location/i)
1027 2 23 if (/Blocked\s+by\s+SpamAssassin/i or /spam\s+rejection/i or /identified\s+SPAM,\s+message\s+permanently\s+rejected/i or /Mail\s+appears\s+to\s+be\s+unsolicited/i or /Message\s+rejected\s+as\s+spam\s+by\s+Content\s+Filtering/i or /message\s+looks\s+like\s+SPAM\s+to\s+me/i or /NOT\s+JUNKEMAILFILTER/i or /your\s+message\s+has\s+triggered\s+a\s+SPAM\s+block/i or /Spam\s+detected/i or /Message\s+looks\s+like\s+spam/i or /Message\s+content\s+rejected,\s+UBE/i or /Blocked\s+using\s+spam\s+pattern/i or /Client\s+host\s+\S+\s+blocked\s+using/i or /breaches\s+local\s+URIBL\s+policy/i or /Your\s+email\s+had\s+spam-like\s+header\s+contents/i or /detected\s+as\s+spam/i or /Denied\s+due\s+to\s+spam\s+list/i or /appears\s+to\s+be\s+unsolicited/i or /antispam\s+checks/i or /Probable\s+Spam/i or /ESETS_SMTP\s+\(spam\)/i or /this\s+message\s+appears\s+to\s+be\s+spam/i or /Spam\s+score\s+\(\S+\)\s+too\s+high/i or /matches\s+a\s+profile\s+the\s+Internet\s+community\s+may\s+consider\s+spam/i or /accepted\s+due\s+to\s+spam\s+filter/i or /content\s+filter\s+rejection/i or /using\s+a\s+mass\s+mailer/i or /Spam\s+email/i or /Spam\s+content/i or /CONTENT\s+REJECT/i and /dspam\s+check/i or /this\s+email\s+is\s+spam/i or /rejected\s+as\s+spam/i or /MCSpamSignature/i or /identified\s+as\s+spam/i or /Spamming\s+not\s+allowed/i or /classified\s+as\s+spam/i or /Message\s+refused\s+by\s+MailMarshal\s+SpamProfiler/i or /Your\s+email\s+appears\s+similar\s+to\s+spam/i or /This\s+message\s+scored\s+\S+\s+spam\s+points\s+and\s+has\s+been\s+rejected/i or /Spam\s+Blocked/i or /bulk\s+e?mail/i or /probably\s+spam/i or /appears\s+to\s+be\s+SPAM/i or /SPAM NOT ACCEPTED/i or /5.9.8\s+spam/i)
1077 2 17 if (/RESOLVER.RST.RecipSizeLimit/i or /exceeds\s+size\s+limit/i or /Message\s+too\s+big/i or /RESOLVER.RST.SendSizeLimit/i or /Message\s+Rejected\s+Class=size/i)
1102 131 1 unless ($message->head->get('X-Mailer') || '') =~ /Internet Mail Service/i
1104 1 0 if ($message->is_multipart) { }
1106 0 1 unless my($error_part) = grep({$_->effective_type eq 'text/plain';} $message->parts)
1108 0 1 unless my($actual_error) = $error_part->as_string =~ /did not reach the following recipient\S+\s*(.*)/is
1112 1 0 if (my $io = $error_part->open('w'))
1119 0 0 unless my($actual_error) = $message->bodyhandle->as_string =~ /did not reach the following recipient\S+\s*(.*)/is
1138 130 2 unless ($message->head->get('Mailer') || '') =~ /AirMail/i
1139 0 2 unless $message->effective_type eq 'text/plain'
1140 0 2 unless $message->bodyhandle->as_string =~ /Your mail to the following recipients could not be delivered because they are not accepting mail/i
1153 0 6 if (/because they are not accepting mail from (\S+?):?/i)
1158 2 4 if (/^\s*(\S+)\s*$/)
1160 0 2 if ($recipient =~ /\@/)
1173 2 0 if (my $io = $message->open('w'))
1190 131 1 unless ($message->head->get('X-Mailer') || '') =~ /Novell Groupwise/i
1191 0 1 unless $message->effective_type eq 'multipart/mixed'
1193 0 1 unless my($error_part) = grep({$_->effective_type eq 'text/plain';} $message->parts)
1202 1 2 if (/^(\s*)(\S+)(\s+\(.*\))$/)
1204 1 0 if ($recipient =~ /\@/)
1217 1 0 if (my $io = $error_part->open('w'))
1248 116 16 unless $message->effective_type eq 'text/plain'
1250 14 2 unless $message->bodyhandle->as_string =~ /The following addresses had permanent fatal errors/
1253 0 2 unless $message->bodyhandle->as_string =~ /Transcript of session follows/
1256 0 2 unless $message->bodyhandle->as_string =~ /Message .* follows/
1271 2 0 if $reporting_mta
1272 2 0 if $arrival_date
1301 2 0 $by_email{$email}{'host'} ? :
1317 2 0 $by_email{$email}{'host'} ? :
0 2 unless $by_email{$email}{'errors'}
1328 0 6 if /RCPT TO:\s*(\S+)/im
1330 2 4 if (/The\s+following\s+addresses\s+had\s+permanent\s+fatal\s+errors\s+-----\s+\?/im)
1334 5 1 if $email
1336 2 4 if (/while talking to (\S+)/im)
1341 2 4 if (/<<< (\d\d\d) (.*)/m)
1346 0 6 if (/^(\d\d\d)\b.*(<\S+\@\S+>)\.*\s+(.+)/m)
1447 1 696 if $_->effective_type eq 'message/xdelivery-status'
1462 1 0 if defined $pos_a and !defined($pos_b) || $pos_a < $pos_b
1470 3 12 $string =~ /$regex/ ? :