diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index 93a1906fac4..05cbcb0ca14 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -1126,9 +1126,9 @@ class CMailFile
if ($this->msgishtml)
{
// Similar code to forge a text from html is also in smtps.class.php
- $strContentAltText = preg_replace("/
]*>/", "\n", $strContent);
+ $strContentAltText = preg_replace("/
]*>/", " ", $strContent);
$strContentAltText = html_entity_decode(strip_tags($strContentAltText));
- $strContentAltText = rtrim(wordwrap($strContentAltText, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)?"\r\n":"\n"));
+ $strContentAltText = trim(wordwrap($strContentAltText, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)?"\r\n":"\n"));
// Check if html header already in message, if not complete the message
$strContent = $this->checkIfHTML($strContent);
diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php
index a66fd267d54..5c5975b9284 100644
--- a/htdocs/core/class/smtps.class.php
+++ b/htdocs/core/class/smtps.class.php
@@ -1383,9 +1383,9 @@ class SMTPs
if ($strType == 'html')
{
// Similar code to forge a text from html is also in CMailFile.class.php
- $strContentAltText = preg_replace("/
]*>/", "\n", $strContent);
+ $strContentAltText = preg_replace("/
]*>/", " ", $strContent);
$strContentAltText = html_entity_decode(strip_tags($strContentAltText));
- $strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n"));
+ $strContentAltText = trim(wordwrap($strContentAltText, 75, "\r\n"));
}
// Make RFC2045 Compliant