From 879ffb3e37743b49a46923c69fe3a3e520eef303 Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Thu, 18 May 2017 20:40:27 +0300 Subject: [PATCH] Change Message-ID regenerate logic (#1432) Add additional configuration to hide x-mailer header (#1426) --- .../v/0.0.0/app/libraries/RainLoop/Actions.php | 18 ++++++++++++++---- .../libraries/RainLoop/Config/Application.php | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index f5747b3e8..62b4ab89a 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -5877,9 +5877,11 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack $sReferences = $this->GetActionParam('References', ''); $oMessage = \MailSo\Mime\Message::NewInstance(); - $oMessage->RegenerateMessageId(); - $oMessage->SetXMailer('RainLoop/'.APP_VERSION); + if (!$this->Config()->Get('security', 'hide_x_mailer_header', false)) + { + $oMessage->SetXMailer('RainLoop/'.APP_VERSION); + } $oFromIdentity = $this->GetIdentityByID($oAccount, $sIdentityID); if ($oFromIdentity) @@ -5892,6 +5894,9 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack $oMessage->SetFrom(\MailSo\Mime\Email::Parse($oAccount->Email())); } + $oFrom = $oMessage->GetFrom(); + $oMessage->RegenerateMessageId($oFrom ? $oFrom->GetDomain() : ''); + if (!empty($sReplyTo)) { $oReplyTo = \MailSo\Mime\EmailCollection::NewInstance($sReplyTo); @@ -6063,12 +6068,17 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack } $oMessage = \MailSo\Mime\Message::NewInstance(); - $oMessage->RegenerateMessageId(); - $oMessage->SetXMailer('RainLoop/'.APP_VERSION); + if (!$this->Config()->Get('security', 'hide_x_mailer_header', false)) + { + $oMessage->SetXMailer('RainLoop/'.APP_VERSION); + } $oMessage->SetFrom(\MailSo\Mime\Email::NewInstance($oIdentity->Email(), $oIdentity->Name())); + $oFrom = $oMessage->GetFrom(); + $oMessage->RegenerateMessageId($oFrom ? $oFrom->GetDomain() : ''); + $sReplyTo = $oIdentity->ReplyTo(); if (!empty($sReplyTo)) { diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php index 4ca4a76ff..5777a8270 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php @@ -207,6 +207,7 @@ class Application extends \RainLoop\Config\AbstractConfig 'allow_admin_panel' => array(true, 'Access settings'), 'allow_two_factor_auth' => array(false), 'force_two_factor_auth' => array(false), + 'hide_x_mailer_header' => array(false), 'admin_panel_host' => array(''), 'admin_panel_key' => array('admin'), 'content_security_policy' => array(''),