diff --git a/core/email.class.inc.php b/core/email.class.inc.php index 8bd7b147f..d929cb887 100644 --- a/core/email.class.inc.php +++ b/core/email.class.inc.php @@ -154,7 +154,7 @@ class EMail implements iEMail */ public function SetInReplyTo(string $sMessageId) { - $this->AddToHeader('In-Reply-To', $sMessageId); + $this->oMailer->SetInReplyTo($sMessageId); } public function SetBody($sBody, $sMimeType = 'text/html', $sCustomStyles = null) diff --git a/sources/Core/Email/EmailLaminas.php b/sources/Core/Email/EmailLaminas.php index 6a5cab3db..b746485fb 100644 --- a/sources/Core/Email/EmailLaminas.php +++ b/sources/Core/Email/EmailLaminas.php @@ -18,6 +18,8 @@ use ExecutionKPI; use InlineImage; use IssueLog; use Laminas\Mail\Header\ContentType; +use Laminas\Mail\Header\InReplyTo; +use Laminas\Mail\Header\MessageId; use Laminas\Mail\Message; use Combodo\iTop\Core\Authentication\Client\Smtp\Oauth; use Laminas\Mail\Transport\File; @@ -374,11 +376,11 @@ class EMailLaminas extends Email { $this->m_aData['message_id'] = $sId; - // Note: Swift will add the angle brackets for you + // Note: The email library will add the angle brackets for you // so let's remove the angle brackets if present, for historical reasons $sId = str_replace(array('<', '>'), '', $sId); - $this->m_oMessage->getHeaders()->addHeaderLine('Message-ID', $sId); + $this->m_oMessage->getHeaders()->addHeader((new MessageId())->setId($sId)); } public function SetReferences($sReferences) @@ -397,7 +399,11 @@ class EMailLaminas extends Email */ public function SetInReplyTo(string $sMessageId) { - $this->AddToHeader('In-Reply-To', $sMessageId); + // Note: Laminas will add the angle brackets for you + // so let's remove the angle brackets if present, for historical reasons + $sId = str_replace(array('<', '>'), '', $sMessageId); + + $this->m_oMessage->getHeaders()->addHeader((new InReplyTo())->setIds([$sId])); } /**