Fix missing ->msgid
This commit is contained in:
parent
95a6d7f8f5
commit
75667833fe
@ -78,6 +78,7 @@ class CMailFile
|
|||||||
//! Defined background directly in body tag
|
//! Defined background directly in body tag
|
||||||
public $bodyCSS;
|
public $bodyCSS;
|
||||||
|
|
||||||
|
public $msgid;
|
||||||
public $headers;
|
public $headers;
|
||||||
public $message;
|
public $message;
|
||||||
/**
|
/**
|
||||||
@ -263,7 +264,8 @@ class CMailFile
|
|||||||
// Add autocopy to (Note: Adding bcc for specific modules are also done from pages)
|
// Add autocopy to (Note: Adding bcc for specific modules are also done from pages)
|
||||||
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
||||||
|
|
||||||
// Action according to choosed sending method
|
// We set all data according to choosed sending method.
|
||||||
|
// We also set a value for ->msgid
|
||||||
if ($this->sendmode == 'mail')
|
if ($this->sendmode == 'mail')
|
||||||
{
|
{
|
||||||
// Use mail php function (default PHP method)
|
// Use mail php function (default PHP method)
|
||||||
@ -274,7 +276,7 @@ class CMailFile
|
|||||||
$text_body = "";
|
$text_body = "";
|
||||||
$files_encoded = "";
|
$files_encoded = "";
|
||||||
|
|
||||||
// Define smtp_headers
|
// Define smtp_headers (this also set ->msgid)
|
||||||
$smtp_headers = $this->write_smtpheaders();
|
$smtp_headers = $this->write_smtpheaders();
|
||||||
if (!empty($moreinheader)) $smtp_headers .= $moreinheader; // $moreinheader contains the \r\n
|
if (!empty($moreinheader)) $smtp_headers .= $moreinheader; // $moreinheader contains the \r\n
|
||||||
|
|
||||||
@ -365,6 +367,9 @@ class CMailFile
|
|||||||
$smtps->setErrorsTo($errors_to);
|
$smtps->setErrorsTo($errors_to);
|
||||||
$smtps->setDeliveryReceipt($deliveryreceipt);
|
$smtps->setDeliveryReceipt($deliveryreceipt);
|
||||||
|
|
||||||
|
$host=dol_getprefix('email');
|
||||||
|
$this->msgid = time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host;
|
||||||
|
|
||||||
$this->smtps = $smtps;
|
$this->smtps = $smtps;
|
||||||
}
|
}
|
||||||
elseif ($this->sendmode == 'swiftmailer')
|
elseif ($this->sendmode == 'swiftmailer')
|
||||||
@ -386,7 +391,8 @@ class CMailFile
|
|||||||
// Adding a trackid header to a message
|
// Adding a trackid header to a message
|
||||||
$headers = $this->message->getHeaders();
|
$headers = $this->message->getHeaders();
|
||||||
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid.'@'.$host);
|
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid.'@'.$host);
|
||||||
$headerID = time().'.swiftmailer-dolibarr-'.$trackid.'@'.$host;
|
$this->msgid = time().'.swiftmailer-dolibarr-'.$trackid.'@'.$host;
|
||||||
|
$headerID = $this->msgid;
|
||||||
$msgid = $headers->get('Message-ID');
|
$msgid = $headers->get('Message-ID');
|
||||||
$msgid->setId($headerID);
|
$msgid->setId($headerID);
|
||||||
$headers->addIdHeader('References', $headerID);
|
$headers->addIdHeader('References', $headerID);
|
||||||
@ -1038,13 +1044,15 @@ class CMailFile
|
|||||||
if ($trackid)
|
if ($trackid)
|
||||||
{
|
{
|
||||||
// References is kept in response and Message-ID is returned into In-Reply-To:
|
// 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
|
$this->msgid = time().'.phpmail-dolibarr-'.$trackid.'@'.$host;
|
||||||
$out .= 'References: <'.time().'.phpmail-dolibarr-'.$trackid.'@'.$host.">".$this->eol2;
|
$out .= 'Message-ID: <'.$this->msgid.">".$this->eol2; // Uppercase seems replaced by phpmail
|
||||||
|
$out .= 'References: <'.$this->msgid.">".$this->eol2;
|
||||||
$out .= 'X-Dolibarr-TRACKID: '.$trackid.'@'.$host.$this->eol2;
|
$out .= 'X-Dolibarr-TRACKID: '.$trackid.'@'.$host.$this->eol2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$out .= 'Message-ID: <'.time().'.phpmail@'.$host.">".$this->eol2;
|
$this->msgid = time().'.phpmail@'.$host;
|
||||||
|
$out .= 'Message-ID: <'.$this->msgid.">".$this->eol2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_SERVER['REMOTE_ADDR'])) $out .= "X-RemoteAddr: ".$_SERVER['REMOTE_ADDR'].$this->eol2;
|
if (!empty($_SERVER['REMOTE_ADDR'])) $out .= "X-RemoteAddr: ".$_SERVER['REMOTE_ADDR'].$this->eol2;
|
||||||
|
|||||||
@ -1304,13 +1304,6 @@ class SMTPs
|
|||||||
$_header .= 'Bcc: ' . $this->getBCC() . "\r\n";
|
$_header .= 'Bcc: ' . $this->getBCC() . "\r\n";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$host=$this->getHost();
|
|
||||||
$usetls = preg_match('@tls://@i', $host);
|
|
||||||
|
|
||||||
$host=preg_replace('@tcp://@i', '', $host); // Remove prefix
|
|
||||||
$host=preg_replace('@ssl://@i', '', $host); // Remove prefix
|
|
||||||
$host=preg_replace('@tls://@i', '', $host); // Remove prefix
|
|
||||||
|
|
||||||
$host=dol_getprefix('email');
|
$host=dol_getprefix('email');
|
||||||
|
|
||||||
//NOTE: Message-ID should probably contain the username of the user who sent the msg
|
//NOTE: Message-ID should probably contain the username of the user who sent the msg
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user