* REST API/Mail: always add signature below supplied body (independent of user preference for reply/forward)

This commit is contained in:
ralf 2023-10-27 10:21:00 +03:00
parent db7d26a6a0
commit f36149ae93

View File

@ -1018,6 +1018,11 @@ class mail_compose
//error_log(__METHOD__.__LINE__.':'.$name.'->'. $_REQUEST['preset'][$name]); //error_log(__METHOD__.__LINE__.':'.$name.'->'. $_REQUEST['preset'][$name]);
if (!empty($_REQUEST['preset'][$name])) $content[$name] = $_REQUEST['preset'][$name]; if (!empty($_REQUEST['preset'][$name])) $content[$name] = $_REQUEST['preset'][$name];
} }
// if we preset the body, we always want the signature below (independent of user preference for replay or forward!)
if (!empty($_REQUEST['preset']['body']))
{
$insertSigOnTop = 'below';
}
} }
// is the to address set already? // is the to address set already?
if (!empty($_REQUEST['send_to'])) if (!empty($_REQUEST['send_to']))
@ -1166,6 +1171,11 @@ class mail_compose
$before = $disableRuler ? "\r\n" : "\r\n-- \r\n"; $before = $disableRuler ? "\r\n" : "\r\n-- \r\n";
$start = $inbetween = "\r\n"; $start = $inbetween = "\r\n";
} }
// if we already have a body in compose (not reply or forward!), do NOT add an empty line above it
if (!empty($content['body']) && !$isReply)
{
$start = '';
}
if ($content['mimeType'] === 'html') if ($content['mimeType'] === 'html')
{ {
$sigText = ($sigTextStartsWithBlockElement?'':"<div>")."<!-- HTMLSIGBEGIN -->".$sigText."<!-- HTMLSIGEND -->".($sigTextStartsWithBlockElement?'':"</div>"); $sigText = ($sigTextStartsWithBlockElement?'':"<div>")."<!-- HTMLSIGBEGIN -->".$sigText."<!-- HTMLSIGEND -->".($sigTextStartsWithBlockElement?'':"</div>");