From 7f35b0e91075d871f87de95b6c84b2353e02f9cf Mon Sep 17 00:00:00 2001
From: Andriy Oblivantsev
Date: Thu, 6 Aug 2026 13:25:53 +0100
Subject: [PATCH] fix(mail): German spacing for invoice draft template
Separate paragraphs with blank lines; mailbox signature uses Synapse MXID.
---
cmd/oo/mails.go | 7 +++++--
mails.go | 10 ++++++++++
mails_test.go | 4 ++++
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/cmd/oo/mails.go b/cmd/oo/mails.go
index 9dd238c..02661bb 100644
--- a/cmd/oo/mails.go
+++ b/cmd/oo/mails.go
@@ -254,16 +254,19 @@ für das Service package (OS image inkl. Backup, Monitoring, RustDesk,
gemeinsamem Datenträger und Netzwerkzugriff).
Zahlungsziel: 14 Tage netto.
-Steuerhinweis: siehe Notizen auf der Rechnung (Reverse Charge / § 13b UStG).
+
+Steuerhinweis: siehe Notizen auf der Rechnung
+(Reverse Charge / § 13b UStG).
Mit freundlichen Grüßen
+
Example Author`, number, cost)
}
draft, err := c.SaveMailDraft(cmd.Context(), onlyoffice.SaveMailDraftParams{
From: from,
To: to,
Subject: subject,
- Body: onlyoffice.PlainTextToMailHTML(body),
+ Body: onlyoffice.MailHTMLWithBlankParagraphs(onlyoffice.PlainTextToMailHTML(body)),
})
if err != nil {
return err
diff --git a/mails.go b/mails.go
index 5ac48a4..e5ab907 100644
--- a/mails.go
+++ b/mails.go
@@ -231,6 +231,16 @@ func PlainTextToMailHTML(s string) string {
return b.String()
}
+// MailHTMLWithBlankParagraphs inserts empty paragraphs between blocks
+// (German Geschäftsbrief-style vertical spacing in OnlyOffice Mail).
+func MailHTMLWithBlankParagraphs(html string) string {
+ html = strings.TrimSpace(html)
+ if html == "" {
+ return ""
+ }
+ return strings.ReplaceAll(html, "
\n", "
\n
\n")
+}
+
// Int64FromMap coerces OnlyOffice numeric id fields (float64/int/string) to int64.
func Int64FromMap(m map[string]any, key string) int64 {
switch v := m[key].(type) {
diff --git a/mails_test.go b/mails_test.go
index 89714b9..be81255 100644
--- a/mails_test.go
+++ b/mails_test.go
@@ -83,6 +83,10 @@ func TestPlainTextToMailHTML(t *testing.T) {
if PlainTextToMailHTML(html) != html {
t.Fatalf("html passthrough failed")
}
+ spaced := MailHTMLWithBlankParagraphs("
A
\nB
")
+ if spaced != "A
\n
\nB
" {
+ t.Fatalf("spaced: %q", spaced)
+ }
}
func TestInt64FromMap(t *testing.T) {