fix original message header broken for signature after

This commit is contained in:
ralf 2022-05-10 13:58:57 +02:00
parent 9a0cc36366
commit 99588796da

View File

@ -483,8 +483,8 @@ class mail_compose
$this->changeProfile($_content['serverID']); $this->changeProfile($_content['serverID']);
$composeProfile = $this->mail_bo->profileID; $composeProfile = $this->mail_bo->profileID;
} }
// make sure $acc is set/initalized properly with the current composeProfile, as $acc is used down there // make sure $acc is set/initialized properly with the current composeProfile, as $acc is used down there
// at several locations and not neccesaryly initialized before // at several locations and not necessary initialized before
$acc = Mail\Account::read($composeProfile); $acc = Mail\Account::read($composeProfile);
$buttonClicked = false; $buttonClicked = false;
if (!empty($_content['composeToolbar']) && $_content['composeToolbar'] === 'send') if (!empty($_content['composeToolbar']) && $_content['composeToolbar'] === 'send')
@ -668,8 +668,7 @@ class mail_compose
$content['is_plain'] = false; $content['is_plain'] = false;
} }
$content['body'] = $content['body'] ?? $content['mail_'.($content['mimeType'] === 'html'?'html':'plain').'text'] ?? $content['body'] = $content['body'] ?? $content['mail_'.($content['mimeType'] === 'html' ? 'html' : 'plain').'text'] ?? '';
($content['mimeType'] === 'html' ? '<br>' : '');
unset($_content['body'], $_content['mail_htmltext'], $_content['mail_plaintext']); unset($_content['body'], $_content['mail_htmltext'], $_content['mail_plaintext']);
$_currentMode = $_content['mimeType'] && $_content['mimeType'] !== 'plain' ? 'html' : 'plain'; $_currentMode = $_content['mimeType'] && $_content['mimeType'] !== 'plain' ? 'html' : 'plain';
@ -1163,25 +1162,29 @@ class mail_compose
if (stripos(trim($sigText),'<'.$e)===0) $sigTextStartsWithBlockElement = true; if (stripos(trim($sigText),'<'.$e)===0) $sigTextStartsWithBlockElement = true;
} }
} }
if($content['mimeType'] == 'html') { if ($content['mimeType'] === 'html')
$before = '<br>'.($disableRuler ? '' : '<hr style="border:1px dotted silver; width:100%;">'); {
$start = "<br/>\n";
$before = $disableRuler ? '' : '<hr style="border:1px dotted silver; width:100%;">';
$inbetween = ''; $inbetween = '';
} else {
$before = ($disableRuler ?"\r\n\r\n":"\r\n\r\n-- \r\n");
$inbetween = "\r\n";
} }
if ($content['mimeType'] == 'html') else
{
$before = $disableRuler ? "\r\n" : "\r\n-- \r\n";
$start = $inbetween = "\r\n";
}
if ($content['mimeType'] === 'html')
{ {
$sigText = ($sigTextStartsWithBlockElement?'':"<div>")."<!-- HTMLSIGBEGIN -->".$sigText."<!-- HTMLSIGEND -->".($sigTextStartsWithBlockElement?'':"</div>"); $sigText = ($sigTextStartsWithBlockElement?'':"<div>")."<!-- HTMLSIGBEGIN -->".$sigText."<!-- HTMLSIGEND -->".($sigTextStartsWithBlockElement?'':"</div>");
} }
if ($insertSigOnTop === 'below') if ($insertSigOnTop === 'below')
{ {
$content['body'] = $content['body'].$before.($content['mimeType'] == 'html'?$sigText:$this->convertHTMLToText($sigText,true,true)); $content['body'] = $start.$content['body'].$before.($content['mimeType'] == 'html'?$sigText:$this->convertHTMLToText($sigText,true,true));
} }
else else
{ {
$content['body'] = $before.($content['mimeType'] == 'html'?$sigText:$this->convertHTMLToText($sigText,true,true)).$inbetween.$content['body']; $content['body'] = $start.$before.($content['mimeType'] == 'html'?$sigText:$this->convertHTMLToText($sigText,true,true)).$inbetween.$content['body'];
} }
} }
// Skip this part if we're merging, it would add an extra line at the top // Skip this part if we're merging, it would add an extra line at the top