Better management of the Dolibarr tracking id into email.
This will allow an imap scanner to link email
This commit is contained in:
parent
74a4006a84
commit
4065b3f1df
@ -152,7 +152,8 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE
|
||||
$subject = $_POST['subject'];
|
||||
$body = $_POST['message'];
|
||||
$deliveryreceipt= $_POST["deliveryreceipt"];
|
||||
|
||||
$trackid = GETPOST('trackid');
|
||||
|
||||
//Check if we have to decode HTML
|
||||
if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($body, ENT_COMPAT | ENT_HTML401))) {
|
||||
$body=dol_html_entity_decode($body, ENT_COMPAT | ENT_HTML401);
|
||||
@ -202,7 +203,9 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE
|
||||
$sendtoccc,
|
||||
$deliveryreceipt,
|
||||
$msgishtml,
|
||||
$errors_to
|
||||
$errors_to,
|
||||
'',
|
||||
$trackid
|
||||
);
|
||||
|
||||
$result=$mailfile->sendfile();
|
||||
@ -693,6 +696,7 @@ else
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||
$formmail->trackid='test';
|
||||
$formmail->withfromreadonly=0;
|
||||
$formmail->withsubstit=0;
|
||||
$formmail->withfrom=1;
|
||||
|
||||
@ -221,11 +221,12 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
$trackid = GETPOST('trackid','aZ');
|
||||
$trackid = GETPOST('trackid','aZ09');
|
||||
|
||||
if($conf->dolimail->enabled)
|
||||
// Feature to push mail sent into Sent folder
|
||||
if (! empty($conf->dolimail->enabled))
|
||||
{
|
||||
$mailfromid = explode ("#", $_POST['frommail'],3);
|
||||
$mailfromid = explode("#", $_POST['frommail'],3); // $_POST['frommail'] = 'aaa#Sent# <aaa@aaa.com>' // TODO Use a better way to define Sent dir.
|
||||
if (count($mailfromid)==0) $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
|
||||
else
|
||||
{
|
||||
@ -243,7 +244,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
{
|
||||
|
||||
$folder=str_replace($ref, '', $mailboxconfig->folder_cache_key);
|
||||
if (!$folder) $folder = "Sent";
|
||||
if (!$folder) $folder = "Sent"; // Default Sent folder
|
||||
|
||||
$mailboxconfig->mbox = imap_open($mailboxconfig->get_connector_url().$folder, $mailboxconfig->mailbox_imap_login, $mailboxconfig->mailbox_imap_password);
|
||||
if (FALSE === $mailboxconfig->mbox)
|
||||
@ -276,17 +277,16 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
if ($result)
|
||||
{
|
||||
$error=0;
|
||||
if($conf->dolimail->enabled)
|
||||
if (! empty($conf->dolimail->enabled))
|
||||
{
|
||||
$mid = (GETPOST('mid','int') ? GETPOST('mid','int') : 0);
|
||||
$mid = (GETPOST('mid','int') ? GETPOST('mid','int') : 0); // Original mail id is set ?
|
||||
if ($mid)
|
||||
{
|
||||
// set imap flag answered if it is a answered mail
|
||||
|
||||
// set imap flag answered if it is an answered mail
|
||||
$dolimail=new DoliMail($db);
|
||||
$dolimail->id = $mid;
|
||||
$res=$dolimail->set_prop($user, 'answered',1);
|
||||
}
|
||||
}
|
||||
if ($imap==1)
|
||||
{
|
||||
// write mail to IMAP Server
|
||||
|
||||
@ -708,8 +708,10 @@ class CMailFile
|
||||
$trackid = $this->trackid;
|
||||
if ($trackid)
|
||||
{
|
||||
$out.= 'Message-ID: <' . time() . '.phpmail-'.$trackid.'@' . $host . ">" . $this->eol2;
|
||||
$out.= 'references: <' . time() . '.phpmail-'.$trackid.'@' . $host . ">" . $this->eol2;
|
||||
// References is kept in response and Message-ID is returned into In-Reply-To:
|
||||
$out.= 'Message-ID: <' . time() . '.phpmail-dolibarr-'.$trackid.'@' . $host . ">" . $this->eol2; // Uppercase seems replaced by phpmail
|
||||
$out.= 'References: <' . time() . '.phpmail-dolibarr-'.$trackid.'@' . $host . ">" . $this->eol2;
|
||||
$out.= 'X-Dolibarr-TRACKID: '.$trackid. $this->eol2;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1133,8 +1133,10 @@ class SMTPs
|
||||
$trackid = $this->getTrackId();
|
||||
if ($trackid)
|
||||
{
|
||||
$_header .= 'Message-ID: <' . time() . '.SMTPs-'.$trackid.'@' . $host . ">\r\n";
|
||||
$_header .= 'references: <' . time() . '.SMTPs-'.$trackid.'@' . $host . ">\r\n";
|
||||
// References is kept in response and Message-ID is returned into In-Reply-To:
|
||||
$_header .= 'Message-ID: <' . time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host . ">\r\n";
|
||||
$_header .= 'References: <' . time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host . ">\r\n";
|
||||
$_header .= 'X-Dolibarr-TRACKID: ' . $trackid . "\r\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -263,6 +263,10 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
|
||||
$out=trim($out);
|
||||
if (preg_match('/[^a-z]+/i',$out)) $out='';
|
||||
break;
|
||||
case 'aZ09':
|
||||
$out=trim($out);
|
||||
if (preg_match('/[^a-z0-9]+/i',$out)) $out='';
|
||||
break;
|
||||
case 'array':
|
||||
if (! is_array($out) || empty($out)) $out=array();
|
||||
break;
|
||||
|
||||
@ -232,7 +232,7 @@ body {
|
||||
<?php } else { ?>
|
||||
background: rgb(<?php print $colorbackbody; ?>);
|
||||
<?php } ?>
|
||||
color: #101010;
|
||||
color: rgb(<?php echo $colortext; ?>);
|
||||
font-size: <?php print $fontsize ?>px;
|
||||
font-family: <?php print $fontlist ?>;
|
||||
margin-top: 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user