mirror of
https://github.com/freescout-helpdesk/freescout.git
synced 2024-11-25 03:43:33 +01:00
Small improvement to bounce detection
This commit is contained in:
parent
503bd57d5e
commit
9b2495edce
@ -242,7 +242,7 @@ class FetchEmails extends Command
|
||||
if ($message->hasAttachments()) {
|
||||
foreach ($attachments as $attachment) {
|
||||
if (!empty(Attachment::$types[$attachment->getType()]) && Attachment::$types[$attachment->getType()] == Attachment::TYPE_MESSAGE) {
|
||||
if (in_array($attachment->getName(), ['RFC822', 'DELIVERY-STATUS'])) {
|
||||
if (in_array(strtoupper($attachment->getName()), ['RFC822', 'DELIVERY-STATUS', 'DELIVERY-STATUS-NOTIFICATION', 'UNDELIVERED-MESSAGE'])) {
|
||||
$is_bounce = true;
|
||||
$bounce_attachment = $attachment;
|
||||
break;
|
||||
@ -251,6 +251,12 @@ class FetchEmails extends Command
|
||||
}
|
||||
}
|
||||
|
||||
// If a bounce was not detected by the attachment check, try to determine a bounce by looking at subject or at From
|
||||
if (!$is_bounce) {
|
||||
$is_bounce = preg_match('/Delivery Status Notification/i', $message->getSubject() )
|
||||
|| preg_match('/mailer-daemon/i', $from );
|
||||
}
|
||||
|
||||
// Is it a message from Customer or User replied to the notification
|
||||
preg_match('/^'.\MailHelper::MESSAGE_ID_PREFIX_NOTIFICATION."\-(\d+)\-(\d+)\-/", $prev_message_id, $m);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user