From a5a1039d22cd04fb8bfdbeb2edcebb6ff15afba8 Mon Sep 17 00:00:00 2001 From: Oliver Kieselbach Date: Thu, 8 Oct 2026 17:59:25 +0200 Subject: [PATCH] E-mail alerts read like messages, not like log lines (junk-folder fix) The first channel mail landed in Junk although SPF, DKIM (mte1/mte2) and DMARC are in order, so the content was the tell: a bracketed, shouting subject built from the machine title "Ops Alert: Platform/PushDeliveryFailed", a raw JSON block, hardly any prose, no text part. Now: subject "Autopilot Monitor: Push delivery failed (Platform)" (event name as words, no tags, no severity word), one introductory sentence naming the severity and category, the event as a heading, facts and the opted-in payload as key/value tables (nested values as compact JSON, non-object payloads still capped), a visible portal link, a footer that says why the mail was sent, a plain-text part of our own (auto_text off for alerts) and the RFC 3834 Auto-Submitted header. Template mails are unchanged. Co-Authored-By: Claude Fable 5.1 --- .../EmailChannelProviderTests.cs | 50 ++-- .../Services/EmailService.cs | 16 +- .../Notifications/EmailAlertRenderer.cs | 220 ++++++++++++++---- .../Notifications/EmailNotificationService.cs | 13 +- 4 files changed, 232 insertions(+), 67 deletions(-) diff --git a/src/Backend/AutopilotMonitor.Functions.Tests/EmailChannelProviderTests.cs b/src/Backend/AutopilotMonitor.Functions.Tests/EmailChannelProviderTests.cs index 7dc55600..f3e9e710 100644 --- a/src/Backend/AutopilotMonitor.Functions.Tests/EmailChannelProviderTests.cs +++ b/src/Backend/AutopilotMonitor.Functions.Tests/EmailChannelProviderTests.cs @@ -139,38 +139,59 @@ public class EmailChannelProviderTests // ── Rendering ───────────────────────────────────────────────────────── [Fact] - public void Renderer_builds_a_prefixed_subject_and_escaped_html_with_facts_sections_links_and_payload() + public void Renderer_reads_like_a_message_not_a_log_line() { var alert = Alert(); - alert.DataJson = "{\"service\":\"apple\",\"statusCode\":401,\"note\":\"