Here comes a bugfix!
Open the file modules/InboundEmail/inboundEmail.php
After PHP Code:
function getMessageText($msgNo, $type, $structure, $fullHeader,$clean_email=true) {
[...]
$msgPart = $text;
substitute: PHP Code:
if(isset($decodedHeader['Content-Type']['charset']) && !empty($decodedHeader['Content-Type']['charset'])) {
$msgPart = $this->handleCharsetTranslation($text, $decodedHeader['Content-Type']['charset']);
}
by: PHP Code:
function array_change_key_case_recursive($input, $case = null){
if(!is_array($input)){
trigger_error("Invalid input array '{$array}'",E_USER_NOTICE); exit;
}
// CASE_UPPER|CASE_LOWER
if(null === $case){
$case = CASE_LOWER;
}
if(!in_array($case, array(CASE_UPPER, CASE_LOWER))){
trigger_error("Case parameter '{$case}' is invalid.", E_USER_NOTICE); exit;
}
$input = array_change_key_case($input, $case);
foreach($input as $key=>$array){
if(is_array($array)){
$input[$key] = array_change_key_case_recursive($array, $case);
}
}
return $input;
}
$upperCaseKeyDecodeHearer = array_change_key_case_recursive($upperCaseKeyDecodeHearer,CASE_UPPER);
if(isset($upperCaseKeyDecodeHearer[strtoupper('Content-Type')][strtoupper('charset')]) && !empty($upperCaseKeyDecodeHearer[strtoupper('Content-Type')][strtoupper('charset')])) {
$msgPart = $this->handleCharsetTranslation($text, $upperCaseKeyDecodeHearer[strtoupper('Content-Type')][strtoupper('charset')]);
}
The point is, that SugarCRM looks for 'Content-Type' instead of a case-insensitive string.
I reused the concept of the upper-cased header array from a few lines above (only we need a recursive function in order to upper-case a multi-dimensional array). Please note that $upperCaseKeyDecodeHearer is problably a typo of ~Header, but I used this from the original code.
This bugfix is NOT upgrade-safe!
Bookmarks