Skip to content

Commit

Permalink
Merge pull request #6 from b1-systems/add-option-mail-received-header
Browse files Browse the repository at this point in the history
Adds an option to toggle the `Received` headers for HTTP connections in Compose.
  • Loading branch information
ralflang authored Aug 16, 2022
2 parents ce0b55a + bd7e1aa commit b7c2ff9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions config/conf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
<configinteger name="htmlsig_img_size" desc="The maximum cumulative size of
image data that can be contained within the signature. 0 will disable
this limit (NOT RECOMMENDED).">30000</configinteger>
<configheader>Add Received header</configheader>
<configboolean name="add_received_header" desc="Adds a header to the mail to
indicate that Horde received the mail via HTTPS, and exposes the client IP
address.">true</configboolean>
</configsection>
</configtab>

Expand Down
10 changes: 6 additions & 4 deletions lib/Compose.php
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ public function buildAndSendMessage(
$body, $header, IMP_Prefs_Identity $identity, array $opts = array()
)
{
global $injector, $prefs, $registry, $session;
global $injector, $prefs, $registry, $session, $conf;

/* Set up defaults. */
$opts = array_merge(array(
Expand Down Expand Up @@ -798,9 +798,11 @@ public function buildAndSendMessage(
$headers = $this->_prepareHeaders($header, $opts);

/* Add a Received header for the hop from browser to server. */
$headers->addHeaderOb(
Horde_Core_Mime_Headers_Received::createHordeHop()
);
if (!isset($conf['compose']['add_received_header']) || ($conf['compose']['add_received_header'] === true)) {
$headers->addHeaderOb(
Horde_Core_Mime_Headers_Received::createHordeHop()
);
}

/* Add the 'User-Agent' header. */
$headers->addHeaderOb(new Horde_Mime_Headers_UserAgent(
Expand Down

0 comments on commit b7c2ff9

Please sign in to comment.