diff --git a/htdocs/lib/CMailFile.class.php b/htdocs/lib/CMailFile.class.php
index 664ed736a59a12e3ba81f0cf61e51233fbfdafd6..1f6ddbcd8c0de67a386510b16ac8b16c12d4ba2d 100644
--- a/htdocs/lib/CMailFile.class.php
+++ b/htdocs/lib/CMailFile.class.php
@@ -228,18 +228,20 @@ class CMailFile
         if (count($filename_list))
         {
             $out = "--" . $this->mime_boundary . "\n";
-            if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING)
-            {
-            	$out .= "Content-Type: text/html; charset=\"iso8859-15\"\n\n";
-            	$out .= "Content-Transfer-Encoding: quoted-printable\n\n";
-            }
-            else
-            {
-            	$out = $out . "Content-Type: text/plain; charset=\"iso8859-15\"\n\n";
-            }
+            $out .= "Content-Type: text/plain; charset=\"iso8859-15\"\n\n";
             //	  $out = $out . "Content-Type: text/plain; charset=\"us-ascii\"\n\n";
         }
-        $out = $out . $msgtext . "\n";
+        if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING)
+        {
+        	$out .= "<html><BODY>\n";
+        	$out .= "<html><head><title></title></head><body>";
+          $out .= $msgtext;
+          $out .= "</body></html>";
+        }
+        else
+        {
+        	$out .= $msgtext . "\n";
+        }
         return $out;
     }
 
@@ -283,6 +285,12 @@ class CMailFile
         
         //    if($this->errors_to != "")
         //$out = $out . "Errors-to: ".$this->errors_to."\n";
+        
+        if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING)
+        {
+        	$out .= "Content-Type: text/html; charset=\"iso-8859-15\"\n";
+        	$out .= "Content-Transfer-Encoding: 8bit\n";
+        }
 
         dolibarr_syslog("CMailFile::write_smtpheaders $out");
         return $out;