From 49e8fdff95309d80b149bcbaa6d288a893df4d67 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 24 Oct 2019 13:05:40 +0300 Subject: [PATCH] email import message id fix --- application/Espo/Core/Mail/Parsers/MailMimeParser.php | 8 +++++++- tests/unit/Espo/Core/Mail/ImporterTest.php | 4 ---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/application/Espo/Core/Mail/Parsers/MailMimeParser.php b/application/Espo/Core/Mail/Parsers/MailMimeParser.php index e32d430624..b4b95a3eb6 100644 --- a/application/Espo/Core/Mail/Parsers/MailMimeParser.php +++ b/application/Espo/Core/Mail/Parsers/MailMimeParser.php @@ -91,7 +91,13 @@ class MailMimeParser public function getMessageMessageId($message) { - return $this->getMessageAttribute($message, 'Message-ID'); + $messageId = $this->getMessageAttribute($message, 'Message-ID'); + + if ($messageId && strlen($messageId) && $messageId[0] !== '<') { + $messageId = '<' . $messageId . '>'; + } + + return $messageId; } public function getAddressNameMap($message) diff --git a/tests/unit/Espo/Core/Mail/ImporterTest.php b/tests/unit/Espo/Core/Mail/ImporterTest.php index ca008f53c4..ae4d841496 100644 --- a/tests/unit/Espo/Core/Mail/ImporterTest.php +++ b/tests/unit/Espo/Core/Mail/ImporterTest.php @@ -144,10 +144,6 @@ class ImporterTest extends \PHPUnit\Framework\TestCase function testImport2() { - if (extension_loaded('mailparse')) { - $this->assertTrue(true); - return; - } $entityManager = $this->entityManager; $config = $this->config;