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

Fix option moreinheader not correctly supported with smtps

parent 3c79f3ac
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,7 @@ class CMailFile
var $deliveryreceipt;
var $eol;
var $eol2;
var $atleastonefile=0;
var $error='';
......@@ -103,7 +104,7 @@ class CMailFile
* @param string $errors_to Email for errors-to
* @param string $css Css option
* @param string $trackid Tracking string
* @param string $moreinheader More in header (for phpmail only for the moment)
* @param string $moreinheader More in header. $moreinheader must contains the "\r\n" (TODO not supported for other MAIL_SEND_MODE different than 'phpmail' and 'smtps' for the moment)
*/
function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='',$trackid='',$moreinheader='')
{
......@@ -117,6 +118,7 @@ class CMailFile
{
$this->eol="\n";
$this->eol2="\n";
$moreinheader = str_replace("\r\n","\n",$moreinheader);
}
// On defini mixed_boundary
......@@ -209,7 +211,7 @@ class CMailFile
$this->deliveryreceipt = $deliveryreceipt;
$this->trackid = $trackid;
$smtp_headers = $this->write_smtpheaders();
if (! empty($moreinheader)) $smtp_headers.=$moreinheader;
if (! empty($moreinheader)) $smtp_headers.=$moreinheader; // $moreinheader contains the \r\n
// Define mime_headers
$mime_headers = $this->write_mimeheaders($filename_list, $mimefilename_list);
......@@ -270,6 +272,7 @@ class CMailFile
$smtps->setFrom($this->getValidAddress($from,0,1));
$smtps->setTrackId($trackid);
$smtps->setReplyTo($this->getValidAddress($from,0,1)); // Set property with this->smtps->setReplyTo after constructor if you want to use another value than the From
if (! empty($moreinheader)) $smtps->setMoreInHeader($moreinheader);
if (! empty($this->html))
{
......@@ -324,6 +327,7 @@ class CMailFile
$this->phpmailer->SetFrom($this->getValidAddress($from,0,1));
$this->phpmailer->SetReplyTo($this->getValidAddress($from,0,1)); // Set property with this->phpmailer->setReplyTo after constructor if you want to use another value than the From
// TODO Add trackid into smtp header
// TODO if (! empty($moreinheader)) ...
if (! empty($this->html))
{
......@@ -377,6 +381,7 @@ class CMailFile
$msgid = $headers->get('Message-ID');
$msgid->setId($headerID);
$headers->addIdHeader('References', $headerID);
// TODO if (! empty($moreinheader)) ...
// Give the message a subject
$this->message->setSubject($this->encodetorfc2822($subject));
......
......@@ -226,6 +226,7 @@ class SMTPs
var $_errorsTo = '';
var $_deliveryReceipt = 0;
var $_trackId = '';
var $_moreInHeader = '';
/**
......@@ -260,16 +261,37 @@ class SMTPs
$this->_trackId = $_val;
}
/**
* Set moreInHeader
*
* @param string $_val Value
* @return void
*/
function setMoreInHeader($_val = '')
{
$this->_moreinheader = $_val;
}
/**
* get trackid
*
* @return string Delivery receipt
* @return string Track id
*/
function getTrackId()
{
return $this->_trackId;
}
/**
* get moreInHeader
*
* @return string moreInHeader
*/
function getMoreInHeader()
{
return $this->_moreinheader;
}
/**
* Set errors to
*
......@@ -1213,6 +1235,8 @@ class SMTPs
{
$_header .= 'Message-ID: <' . time() . '.SMTPs@' . $host . ">\r\n";
}
if ( $this->getMoreInHeader() )
$_header .= $this->getMoreInHeader(); // Value must include the "\r\n";
//$_header .=
// 'Read-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n"
......@@ -1233,8 +1257,9 @@ class SMTPs
if ( $this->getReplyTo() )
$_header .= "Reply-To: ".$this->getReplyTo('addr') ."\r\n";
$_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n"
. 'Mime-Version: 1.0' . "\r\n";
$_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n";
$_header .= 'Mime-Version: 1.0' . "\r\n";
return $_header;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment