From 9d4524f7445e4e7ae687ffc8ca818394a3d3222c Mon Sep 17 00:00:00 2001 From: ralf Date: Fri, 27 Oct 2023 10:21:00 +0300 Subject: [PATCH] * REST API/Mail: always add signature below supplied body (independent of user preference for reply/forward) --- mail/inc/class.mail_compose.inc.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 040dd21363..e37df3f223 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -1018,6 +1018,11 @@ class mail_compose //error_log(__METHOD__.__LINE__.':'.$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? if (!empty($_REQUEST['send_to'])) @@ -1166,6 +1171,11 @@ class mail_compose $before = $disableRuler ? "\r\n" : "\r\n-- \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') { $sigText = ($sigTextStartsWithBlockElement?'':"
")."".$sigText."".($sigTextStartsWithBlockElement?'':"
");