2
0
forked from Wavyzz/dolibarr

Start to introduce MAIN_EMAIL_ADD_TRACK_ID option to test inclusion of

tracking id into email.
This commit is contained in:
Laurent Destailleur
2015-03-03 18:33:53 +01:00
parent e667c3e916
commit fddbca50b1
3 changed files with 28 additions and 8 deletions

View File

@@ -36,12 +36,12 @@
*/ */
class CMailFile class CMailFile
{ {
var $subject; // Topic: Subject of email 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"). // 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. // Return-Path: Email where to send bounds.
var $errors_to; // Errors-To: Email where to send errors. var $errors_to; // Errors-To: Email where to send errors.
var $addr_to; var $addr_to;
var $addr_cc; var $addr_cc;
var $addr_bcc; var $addr_bcc;

View File

@@ -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 * Return true if email has a domain name that can't be resolved
* *

View File

@@ -2129,6 +2129,11 @@ else
$formmail->fromid = $user->id; $formmail->fromid = $user->id;
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $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->withfrom=1;
$formmail->withtopic=1; $formmail->withtopic=1;
$liste=array(); $liste=array();