From 5129ebec5cadfc5e20b10bac60060d3ce95c6601 Mon Sep 17 00:00:00 2001 From: justin Date: Sat, 6 Jun 2026 03:31:22 -0500 Subject: [PATCH] healthcare email: add List-Unsubscribe/List-Id/Date/Precedence bulk headers to improve inbox placement on the cold hc IPs --- scripts/build_healthcare_campaigns.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/build_healthcare_campaigns.py b/scripts/build_healthcare_campaigns.py index 3327fd6..6f69f25 100644 --- a/scripts/build_healthcare_campaigns.py +++ b/scripts/build_healthcare_campaigns.py @@ -224,7 +224,7 @@ def cmd_render(): def cmd_send_test(to_addr: str, host: str, port: int): - ctx = None + from email.utils import formatdate n = 0 for key in SEGMENTS: subj, html = render(key, test=True) @@ -233,7 +233,16 @@ def cmd_send_test(to_addr: str, host: str, port: int): msg["From"] = formataddr((FROM_NAME, FROM_EMAIL)) msg["To"] = to_addr msg["Reply-To"] = REPLY_TO + msg["Date"] = formatdate(localtime=True) msg["Message-ID"] = make_msgid(domain="performancewest.net") + # Bulk-mail deliverability headers (Gmail/GMX strongly reward these). + msg["List-Unsubscribe"] = ( + f", " + f"<{SITE}/unsubscribe?e={to_addr}>") + msg["List-Unsubscribe-Post"] = "List-Unsubscribe=One-Click" + msg["List-Id"] = "Performance West Healthcare Compliance " + msg["Precedence"] = "bulk" + msg["X-Entity-Ref-ID"] = make_msgid(domain="performancewest.net") msg.attach(MIMEText("Please view this email in HTML.", "plain")) msg.attach(MIMEText(html, "html")) with smtplib.SMTP(host, port, timeout=15) as s: