From: Seamus Lee Date: Fri, 18 Sep 2015 04:34:20 +0000 (+0000) Subject: Further tweeks following testing X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0addad128b42c7756e3825afa2d3caff6804bc98;p=civicrm-core.git Further tweeks following testing --- diff --git a/CRM/Utils/Mail/EmailProcessor.php b/CRM/Utils/Mail/EmailProcessor.php index 3418185e64..394aa52e7c 100644 --- a/CRM/Utils/Mail/EmailProcessor.php +++ b/CRM/Utils/Mail/EmailProcessor.php @@ -288,7 +288,7 @@ class CRM_Utils_Mail_EmailProcessor { $text = $mail->body->text; } elseif ($mail->body instanceof ezcMailMultipart) { - if ($mail->body instanceof ezcMailMultipartReport) { + if ($mail->body instanceof ezcMailMultipartReport) { $part = $mail->body->getMachinePart(); if ($part instanceof ezcMailDeliveryStatus) { foreach ($part->recipients as $rec) { @@ -296,12 +296,25 @@ class CRM_Utils_Mail_EmailProcessor { $text = $rec["Diagnostic-Code"]; break; } - } - if (empty($text)) { - $text = $part->text; + elseif (isset($rec["Description"])) { + $text = $rec["Description"]; + break; + } + // no diagnostic info present - try getting the human readable part + elseif (isset($rec["Status"])) { + $text = $rec["Status"]; + $textpart = $mail->body->getReadablePart(); + if ($textpart != NULL and isset($textpart->text)) { + $text .= " " . $textpart->text; + } + else { + $text .= " Delivery failed but no diagnostic code or description."; + } + break; + } } } - elseif ($part != NULL) { + elseif ($part != NULL and isset($part->text)) { $text = $part->text; } elseif (($part = $mail->body->getReadablePart()) != NULL) { @@ -339,7 +352,7 @@ class CRM_Utils_Mail_EmailProcessor { $text = $rec["Description"]; } else { - $text = "Delivery to the following recipients failed"; + $text = $rec["Status"] . " Delivery to the following recipients failed"; } break; }