Commit ae52d966 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'B12701-spacesInMails' into 'develop'

B12701 spaces in mails

See merge request !354
parents 12452a4a 6a50e416
Pipeline #5370 passed with stages
in 3 minutes and 15 seconds
......@@ -235,6 +235,18 @@ Switch off the TLS encryption. In :ref:`configuration` specify for *config.sendE
-o tls=no
.. _`sendEmailSpaces`:
sendEmail: 'random' injected spaces
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If in emails unwanted spaces appear, please check that the body does not contain lines longer than 1000 characters.
The spaces will be inserted by the email system in such long lines and has nothing to do with QFQ.
In HTML mails, this
situation might happen if all newlines will be replaced by ``<br>``. To prevent this situation, QFQ will check for
``<br>`` (without newline) and add automatically a newline behind it. This applies only to email body texts.
.. _`javascriptProblem`:
Javascript problem
......
......@@ -3,13 +3,12 @@
namespace IMATHUZH\Qfq\Core\Report;
use IMATHUZH\Qfq\Core\Database\Database;
use IMATHUZH\Qfq\Core\Helper\HelperFile;
use IMATHUZH\Qfq\Core\Helper\OnArray;
use IMATHUZH\Qfq\Core\Helper\Path;
use IMATHUZH\Qfq\Core\Store\Store;
use IMATHUZH\Qfq\Core\Helper\Sanitize;
use IMATHUZH\Qfq\Core\Helper\HelperFile;
use IMATHUZH\Qfq\Core\Helper\Support;
use IMATHUZH\Qfq\Core\Store\Store;
const SENDMAIL_HTML_TOKEN = '<html>';
......@@ -156,6 +155,11 @@ class SendMail {
if (isset($mailConfig[SENDMAIL_TOKEN_BODY_MODE]) && $mailConfig[SENDMAIL_TOKEN_BODY_MODE] === SENDMAIL_TOKEN_BODY_MODE_HTML) {
$mailConfig[SENDMAIL_TOKEN_BODY] = Support::wrapTag(SENDMAIL_HTML_TOKEN, $mailConfig[SENDMAIL_TOKEN_BODY]);
// At least HTML code cleaned by QNL2BR() is missing any '\r\n'. A typicall MTA will inject a line break every 1000 Characters -
// this might be in the middle of a word or URL. To prevent this, reinsert '\r\n' after each <br>.
// First normalize existing "<br>\r\n" to "<br>", than replace "<br>" by "<br>\r\n".
$mailConfig[SENDMAIL_TOKEN_BODY] = str_ireplace("<br>", "<br>\r\n",
str_ireplace("<br>\r\n", "<br>", $mailConfig[SENDMAIL_TOKEN_BODY]));
}
foreach ($mailConfig as $key => $value) {
......@@ -462,7 +466,7 @@ class SendMail {
$param = explode(PARAM_DELIMITER, $data);
// Iterate over all parameter: use token as key. Collect corresponding attachments arguments in separate array elements.
foreach ($param AS $line) {
foreach ($param as $line) {
if (empty($line)) {
continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment