Skip to content
Snippets Groups Projects
Commit fddbca50 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Start to introduce MAIN_EMAIL_ADD_TRACK_ID option to test inclusion of

tracking id into email.
parent e667c3e9
No related branches found
No related tags found
No related merge requests found
......@@ -37,9 +37,9 @@
class CMailFile
{
var $subject; // Topic: Subject of email
var $addr_from; // From: Label of sender (name but can contains an email inside <>)
var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@mydomain.com>' or 'John Doe <myemail@mydomain.com>' or '<myemail+trackingid@mydomain.com>')
// Sender: Who send the email ("Sender" has sent emails on behalf of "From").
// Use it with an email from a sending host from is a SPF protected domain and sending host is not this domain.
// Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, use for Sender an email of the protected domain.
// Return-Path: Email where to send bounds.
var $errors_to; // Errors-To: Email where to send errors.
var $addr_to;
......
......@@ -371,6 +371,21 @@ function dol_print_object_info($object)
}
}
/**
* Return an email formatted to include a tracking id
* For example myemail@mydomain.com becom myemail+trackingid@mydomain.com
*
* @param string $email Email address (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
* @param string $trackingid Tracking id (Ex: thi123 for thirdparty with id 123)
* @return boolean True if domain email is OK, False if KO
*/
function dolAddEmailTrackId($email, $trackingid)
{
$tmp=explode('@',$email);
return $tmp[0].'+'.$trackingid.'@'.(isset($tmp[1])?$tmp[1]:'');
}
/**
* Return true if email has a domain name that can't be resolved
*
......
......@@ -2129,6 +2129,11 @@ else
$formmail->fromid = $user->id;
$formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email;
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID))
{
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'thi'.$object->id);
}
$formmail->withfrom=1;
$formmail->withtopic=1;
$liste=array();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment