diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index 51730bf128ec28b64d46664e003fbaa9259077b5..027bedebb6ef2756f4d4ad023eedb89df6cc2bb8 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -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,7 +272,8 @@ 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))
 			{
 				if (!empty($css))
@@ -324,7 +327,8 @@ 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))
 			{
 				if (!empty($css))
@@ -377,7 +381,8 @@ 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));
 
diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php
index 6ad73d10ac569277eb682bbc7dc8f35e76579069..083bec812fac625181b1276b66c8f53a2d7662ae 100644
--- a/htdocs/core/class/smtps.class.php
+++ b/htdocs/core/class/smtps.class.php
@@ -225,7 +225,8 @@ class SMTPs
 	var $log = '';
 	var $_errorsTo = '';
 	var $_deliveryReceipt = 0;
-    var $_trackId = '';
+	var $_trackId = '';
+	var $_moreInHeader = '';
 
 
     /**
@@ -261,15 +262,36 @@ class SMTPs
 	}
 
     /**
+     * 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,7 +1235,9 @@ 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"
 		//                 'Return-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n";
@@ -1227,15 +1251,16 @@ class SMTPs
 
 		// DOL_CHANGE LDR
 		if ( $this->getDeliveryReceipt() )
-		$_header .= 'Disposition-Notification-To: '.$this->getFrom('addr') . "\r\n";
+		    $_header .= 'Disposition-Notification-To: '.$this->getFrom('addr') . "\r\n";
 		if ( $this->getErrorsTo() )
-		$_header .= 'Errors-To: '.$this->getErrorsTo('addr') . "\r\n";
+		    $_header .= 'Errors-To: '.$this->getErrorsTo('addr') . "\r\n";
 		if ( $this->getReplyTo() )
-        $_header .= "Reply-To: ".$this->getReplyTo('addr') ."\r\n";
+		    $_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;
 	}