diff --git a/htdocs/includes/smtps/SMTPs.php b/htdocs/includes/smtps/SMTPs.php index 3224562201d..efd166fa00f 100644 --- a/htdocs/includes/smtps/SMTPs.php +++ b/htdocs/includes/smtps/SMTPs.php @@ -1992,6 +1992,8 @@ class SMTPs { $content = 'Content-Type: multipart/mixed;' . "\r\n" . ' boundary="' . $this->_getBoundary() . '"' . "\r\n" + . "\r\n" + . 'This is a multi-part message in MIME format.' . "\r\n" . "\r\n--" . $this->_getBoundary() . "\r\n" . 'Content-Type: multipart/related;' . "\r\n" . ' boundary="' . $this->_getRelatedBoundary() . '"' . "\r\n"; @@ -1999,7 +2001,9 @@ class SMTPs else { $content = 'Content-Type: multipart/mixed;' . "\r\n" - . ' boundary="' . $this->_getBoundary() . '"' . "\r\n"; + . ' boundary="' . $this->_getBoundary() . '"' . "\r\n" + . "\r\n" + . 'This is a multi-part message in MIME format.' . "\r\n"; $attachment=1; } } @@ -2016,9 +2020,8 @@ class SMTPs //$content = 'Content-Type: multipart/mixed;' . "\r\n" // . ' boundary="' . $this->_getBoundary() . '"' . "\r\n" // . "\r\n" - $content .= "\r\n" - // END DOL_CHANGE LDR - . 'This is a multi-part message in MIME format.' . "\r\n"; + // . 'This is a multi-part message in MIME format.' . "\r\n"; + // END DOL_CHANGE LDR // Loop through message content array foreach ($this->_msgContent as $type => $_content ) @@ -2089,9 +2092,10 @@ class SMTPs //$content .= ( $type == 'html') ? '; name="HTML Part"' : ''; // DOL_CHANGE LDR $content .= "\r\n"; $content .= 'Content-Transfer-Encoding: '; - $content .= ( $type == 'html') ? 'quoted-printable' : $this->getTransEncodeType(); + //$content .= ( $type == 'html') ? 'quoted-printable' : $this->getTransEncodeType(); // DOL_CHANGE LDR + $content .= ( $type == 'html') ? '8bit' : $this->getTransEncodeType(); $content .= "\r\n" - . 'Content-Disposition: inline' . "\r\n" + //. 'Content-Disposition: inline' . "\r\n" . 'Content-Description: ' . $type . ' message' . "\r\n"; if ( $this->getMD5flag() ) @@ -2568,6 +2572,11 @@ class SMTPs /** * $Log$ + * Revision 1.5 2009/05/12 10:12:02 hregis + * Add: possibilité d'envoyer un fichier attaché avec du html contenant des images avec + * la classe SMTPS + * Fix: 'quoted-printable' truncated html code + * * Revision 1.4 2009/05/12 08:39:40 hregis * Add: possibilité d'envoyer un fichier attaché avec du html contenant des images avec * la classe SMTPS diff --git a/htdocs/lib/CMailFile.class.php b/htdocs/lib/CMailFile.class.php index 7a91dff701d..2c0777a4d83 100644 --- a/htdocs/lib/CMailFile.class.php +++ b/htdocs/lib/CMailFile.class.php @@ -92,8 +92,8 @@ class CMailFile // Evite caractere bizarre avec les accents //Todo l'envoi par mailing donne des caractères bizarre, // alors que l'envoi d'un document facture ou autre est correcte - //$subject = utf8_decode($subject); - //$from = utf8_decode($from); + $subject = utf8_decode($subject); + $from = utf8_decode($from); // If ending method not defined if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail'; @@ -219,6 +219,7 @@ class CMailFile $smtps->setTO($to); $smtps->setFrom($from); if ($this->atleastoneimage) $msg = $this->html; + $msg = $this->checkIfHTML($msg); if ($this->msgishtml) $smtps->setBodyContent($msg,'html'); else $smtps->setBodyContent($msg,'plain'); @@ -573,12 +574,8 @@ class CMailFile if ($this->msgishtml) { // Check if html header already in message - $htmlalreadyinmsg=0; - if (eregi('^[ \t]*checkIfHTML($msgtext); - if (! $htmlalreadyinmsg) $out .= ""; - $out.= $msgtext; - if (! $htmlalreadyinmsg) $out .= ""; if ($this->atleastonefile || $this->atleastoneimage) { if ($this->atleastonefile && $this->atleastoneimage) @@ -602,6 +599,22 @@ class CMailFile return $out; } + + function checkIfHTML($msg) + { + if (!eregi('^[ \t]*images_encoded[$i]['cid'] = $img["cid"]; // Encodage de l'image - $this->images_encoded[$i]["image_encoded"] = chunk_split(base64_encode($image), 68, $this->eol); + $this->images_encoded[$i]["image_encoded"] = rtrim(chunk_split(base64_encode($image), 68, $this->eol)); } $i++; }