Skip to content

Commit

Permalink
Fixed #7880 - Inbound email body contains utf8 hex code instead of re…
Browse files Browse the repository at this point in the history
…al char (e.g. à = =C3=A0; è = =C3=A8)
  • Loading branch information
Dillon-Brown committed Sep 24, 2019
1 parent 2ff5504 commit be2dfdf
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions modules/InboundEmail/InboundEmail.php
Expand Up @@ -3988,12 +3988,30 @@ public function getMessageTextWithUid(
$bcOffset = ''
) {
$email = $this->imap->fetchBody($uid, '', FT_UID);
$msgPart = $this->mailParser->parse($email)->getHtmlContent();
$msgPart = $this->customGetMessageText($msgPart);
$emailHTML = $this->mailParser->parse($email)->getHtmlContent();
$emailHTML = $this->customGetMessageText($emailHTML);

return SugarCleaner::cleanHtml($msgPart, true);
return SugarCleaner::cleanHtml($emailHTML, true);
}

/**
* Returns email HTML with visible inline images.
* @param string $emailHTML
* @return mixed|string
*/
protected function handleInlineImages($emailHTML) {
foreach ($this->mailParser->parse($emailHTML)->getAllAttachmentParts() as $attachment) {
$disposition = $attachment->getContentDisposition();
if ($disposition === 'inline') {
$fileName = $attachment->getFilename();
$fileID = $attachment->getContentId();
$newImagePath = "class=\"image\" src=\"{$this->imagePrefix}{$fileName}\"";
$preImagePath = "src=\"cid:$fileID\"";
$emailHTML = str_replace($preImagePath, $newImagePath, $emailHTML);
}
}
return $emailHTML;
}

/**
* @param $uid
Expand Down

0 comments on commit be2dfdf

Please sign in to comment.