From 17df46cb6c3171d509576ae1342707c85525e4a8 Mon Sep 17 00:00:00 2001 From: Thomas Hackner Date: Tue, 7 Jul 2026 09:18:44 +0000 Subject: [PATCH] =?UTF-8?q?Reply-Mail:=20Zeilenumbr=C3=BCche=20als=20
?= =?UTF-8?q?=20statt=20white-space:pre-wrap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ausgehende Antwort-Mails (multipart/alternative) rendern den HTML-Teil bisher über white-space:pre-wrap auf rohen Zeilenumbrüchen ohne
. Beim ersten Empfang korrekt, aber sobald der Empfänger-Client (Outlook) die Mail zitiert, wird der pre-wrap-Stil verworfen und die nackten Newlines zu Leerzeichen kollabiert -> unser formatiertes Anschreiben wird im Zitat zur zusammenhanglosen Textwand. Explizite
überleben diesen Round-Trip. Co-Authored-By: Claude Opus 4.8 --- lib/mailer.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/mailer.js b/lib/mailer.js index 2838781..04f703b 100644 --- a/lib/mailer.js +++ b/lib/mailer.js @@ -62,12 +62,22 @@ async function verify() { } // Minimal HTML rendering of a plain-text body: escape, then turn newlines into -//
. Sending multipart/alternative (text + html) reads as normal personal -// mail and avoids the "text-only, no html" heuristic some filters apply. +// explicit
tags. Sending multipart/alternative (text + html) reads as +// normal personal mail and avoids the "text-only, no html" heuristic some +// filters apply. +// +// The line breaks MUST be real
tags, not merely CSS white-space:pre-wrap +// on literal newlines: pre-wrap renders correctly on first receipt, but when +// the recipient's client (e.g. Outlook) quotes the message back to us it +// re-parses the HTML, drops the pre-wrap style and collapses the bare newlines +// into spaces — turning our carefully formatted reply into a run-on wall of +// text in the quoted thread. Explicit
survives that round-trip. function textToHtml(text) { const esc = String(text || '') - .replace(/&/g, '&').replace(//g, '>'); - return `
${esc}
`; + .replace(/&/g, '&').replace(//g, '>') + .replace(/\r\n?/g, '\n') + .replace(/\n/g, '
\n'); + return `
${esc}
`; } // Send one message via authenticated submission. Returns nodemailer info