From 530d3503f5b11fb29aa662b942f87180631493f1 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Wed, 14 Dec 2016 10:32:10 +0100
Subject: [PATCH] FIX Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve
 pb of tracking email.

---
 htdocs/core/lib/functions.lib.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index aaff894fcf9..e0acccfe0c0 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -290,8 +290,15 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
  */
 function dol_getprefix()
 {
+    global $conf;
+    
 	if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"]))
 	{
+	    if (! empty($conf->gobal->MAIL_PREFIX_FOR_EMAIL_ID))
+	    {
+	        if ($conf->gobal->MAIL_PREFIX_FOR_EMAIL_ID == 'SERVER_NAME') return $_SERVER["SERVER_NAME"];
+	        return $conf->gobal->MAIL_PREFIX_FOR_EMAIL_ID;
+	    }
 		return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
 		// Use this for a "clear" cookie name
 		//return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
-- 
GitLab