feat(mail): company signature for the no-reply sender (#45)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m27s
ci / image (push) Successful in 36s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
This commit was merged in pull request #45.
This commit is contained in:
sharangandClaude Opus 5.5 committed 2026-09-29 11:04:43 +00:00
1 parent b424e001dc
commit 874c399e31
8 files changed
+75 -2

No files matched your search

+29
View File
@@ -121,3 +121,32 @@ func TestSMTP_dialFailure(t *testing.T) {
t.Fatalf("got %v", err)
}
}
// Every mail carries the company signature for the no-reply sender, in the
// mail's language, in both bodies.
func TestRender_signature(t *testing.T) {
for _, kind := range []string{KindDocumentPublished, KindFindingsNew} {
for _, c := range []struct{ lang, greeting, team string }{
{"de", "Mit freundlichen Grüßen", "Ihr BreakPilot-Team"},
{"en", "Kind regards", "Your BreakPilot team"},
} {
m, err := Render(kind, c.lang, View{Tenant: "acme", URL: "https://app/acme",
D: map[string]any{"title": "T", "target_name": "fw", "new_count": 2}})
if err != nil {
t.Fatal(err)
}
for _, body := range []string{m.Text, m.HTML} {
for _, want := range []string{c.greeting, c.team, "Breakpilot GmbH", "78351 Bodman-Ludwigshafen",
"noreply@breakpilot.com", "kontakt@breakpilot.com", "DE464808363", "HRB 736403", "Sharang Deepak Parnerkar"} {
if !strings.Contains(body, want) {
t.Errorf("%s/%s: %q missing", kind, c.lang, want)
}
}
}
// The signature comes before the "why you get this" footer.
if strings.Index(m.Text, c.team) > strings.Index(m.Text, "\n--\n") {
t.Errorf("%s/%s: signature after the footer", kind, c.lang)
}
}
}
}
+2 -2
View File
@@ -45,7 +45,7 @@ func Render(kind, locale string, v View) (Message, error) {
v.D = map[string]any{}
}
file := "templates/" + locale + "_" + kind + ".tmpl"
tt, err := texttpl.ParseFS(templates, file)
tt, err := texttpl.ParseFS(templates, "templates/signature.tmpl", file)
if err != nil {
return Message{}, err
}
@@ -57,7 +57,7 @@ func Render(kind, locale string, v View) (Message, error) {
return Message{}, err
}
v.Subject = strings.Join(strings.Fields(subj.String()), " ")
ht, err := htmltpl.ParseFS(templates, "templates/layout.html", file)
ht, err := htmltpl.ParseFS(templates, "templates/layout.html", "templates/signature.tmpl", file)
if err != nil {
return Message{}, err
}
@@ -16,6 +16,8 @@ BreakPilot hat im Arbeitsbereich {{.Tenant}} ein Dokument veröffentlicht:
Sie finden es im Portal unter "Dokumente":
{{.URL}}
{{template "signature_text" .}}
--
Sie erhalten diese E-Mail, weil Sie im Arbeitsbereich {{.Tenant}} Unterlagen einsehen dürfen.
BreakPilot GmbH · https://breakpilot.com/impressum{{end}}
@@ -24,6 +24,8 @@ Im Befund sehen Sie Fundstelle, Schweregrad und, soweit zugeordnet, die betroffe
Befunde ansehen:
{{.URL}}
{{template "signature_text" .}}
--
Sie erhalten diese E-Mail, weil Sie den Arbeitsbereich {{.Tenant}} verwalten.
Breakpilot GmbH · https://breakpilot.com/impressum{{end}}
@@ -16,6 +16,8 @@ BreakPilot published a document in the {{.Tenant}} workspace:
You find it in the portal under "Documents":
{{.URL}}
{{template "signature_text" .}}
--
You receive this email because you may view documents in the {{.Tenant}} workspace.
BreakPilot GmbH · https://breakpilot.com/impressum{{end}}
@@ -24,6 +24,8 @@ Each finding shows where it is, how severe it is and, where mapped, the CRA requ
View the findings:
{{.URL}}
{{template "signature_text" .}}
--
You receive this email because you administer the {{.Tenant}} workspace.
Breakpilot GmbH · https://breakpilot.com/impressum{{end}}
+3
View File
@@ -16,6 +16,9 @@
<tr><td style="padding:8px 28px 28px 28px;">
<a href="{{.URL}}" style="display:inline-block;background:#4F46E5;color:#ffffff;text-decoration:none;font-weight:bold;font-size:14px;padding:11px 20px;border-radius:8px;">{{template "button" .}}</a>
</td></tr>
<tr><td style="padding:4px 28px 24px 28px;">
{{template "signature_html" .}}
</td></tr>
<tr><td style="padding:18px 28px;border-top:1px solid #EFF0F6;font-size:11.5px;line-height:1.6;color:#5E6384;">
{{template "footer" .}}<br>
Breakpilot GmbH · <a href="https://breakpilot.com/impressum" style="color:#5E6384;">{{if eq .Lang "de"}}Impressum{{else}}Imprint{{end}}</a> · <a href="https://breakpilot.com/datenschutz" style="color:#5E6384;">{{if eq .Lang "de"}}Datenschutz{{else}}Privacy{{end}}</a>
+33
View File
@@ -0,0 +1,33 @@
{{/* The company signature of every mail, modelled on the founders' signature
(Brand_Assets/Email_Signature) but for the no-reply sender. Company data
as in the website's Impressum. */}}
{{define "signature_html"}}<table role="presentation" cellpadding="0" cellspacing="0" style="font-size:13px;line-height:1.5;color:#14162B;border-collapse:collapse;">
<tr><td style="vertical-align:top;">
<div style="font-size:12px;color:#71769B;">{{if eq .Lang "de"}}Mit freundlichen Grüßen{{else}}Kind regards{{end}}</div>
<div style="font-size:16px;font-weight:800;letter-spacing:-0.02em;color:#14162B;margin:1px 0 10px;">{{if eq .Lang "de"}}Ihr BreakPilot-Team{{else}}Your BreakPilot team{{end}}</div>
<div style="font-weight:700;color:#14162B;">Breakpilot GmbH</div>
<div style="color:#43466A;">In Steinäckern 16</div>
<div style="color:#43466A;">78351 Bodman-Ludwigshafen</div>
<div style="color:#43466A;margin-top:10px;"><span style="color:#9a9db8;">E-Mail:</span> noreply@breakpilot.com <span style="color:#9a9db8;">({{if eq .Lang "de"}}keine Antworten{{else}}no replies{{end}})</span></div>
<div style="color:#43466A;"><span style="color:#9a9db8;">{{if eq .Lang "de"}}Kontakt{{else}}Contact{{end}}:</span> <a href="mailto:kontakt@breakpilot.com" style="color:#4F46E5;text-decoration:none;">kontakt@breakpilot.com</a></div>
<div style="color:#43466A;"><span style="color:#9a9db8;">Web:</span> <a href="https://www.breakpilot.com" style="color:#4F46E5;text-decoration:none;">www.breakpilot.com</a></div>
<div style="border-top:1px solid #E1E1EA;margin:12px 0 9px;width:300px;max-width:100%;font-size:0;line-height:0;">&nbsp;</div>
<div style="font-size:11px;color:#8b8fae;">USt.-ID: DE464808363</div>
<div style="font-size:11px;color:#8b8fae;">Amtsgericht Freiburg, HRB 736403</div>
<div style="font-size:11px;color:#8b8fae;">{{if eq .Lang "de"}}Geschäftsführer{{else}}Managing directors{{end}}: Benjamin Bönisch {{if eq .Lang "de"}}und{{else}}and{{end}} Sharang Deepak Parnerkar</div>
</td></tr></table>{{end}}
{{define "signature_text"}}{{if eq .Lang "de"}}Mit freundlichen Grüßen
Ihr BreakPilot-Team{{else}}Kind regards
Your BreakPilot team{{end}}
Breakpilot GmbH
In Steinäckern 16
78351 Bodman-Ludwigshafen
E-Mail: noreply@breakpilot.com ({{if eq .Lang "de"}}keine Antworten{{else}}no replies{{end}})
{{if eq .Lang "de"}}Kontakt{{else}}Contact{{end}}: kontakt@breakpilot.com
Web: www.breakpilot.com
USt.-ID: DE464808363
Amtsgericht Freiburg, HRB 736403
{{if eq .Lang "de"}}Geschäftsführer{{else}}Managing directors{{end}}: Benjamin Bönisch {{if eq .Lang "de"}}und{{else}}and{{end}} Sharang Deepak Parnerkar{{end}}