fix: pass local_hostname to smtplib so EHLO is FQDN-shaped

Gitea runner pods don't set setHostnameAsFQDN, so socket.getfqdn() returns
the single-label pod name. Stalwart's reject-non-fqdn rule (mail.md
<smtp-from-k8s-pod>) refuses the EHLO before MAIL FROM. Pass an explicit
FQDN to keep the action self-contained.
This commit is contained in:
Donavan Fritz
2026-05-13 09:22:04 -07:00
parent d51c089112
commit a1a09d988e
+5 -1
View File
@@ -307,8 +307,12 @@ def main() -> int:
msg.set_content(text) msg.set_content(text)
msg.add_alternative(html, subtype="html") msg.add_alternative(html, subtype="html")
# Force a FQDN-shaped EHLO. Runner pods don't set setHostnameAsFQDN, so
# socket.getfqdn() returns the single-label pod name and Stalwart's
# reject-non-fqdn rule trips before MAIL FROM. See k8s-manager skill
# mail.md <smtp-from-k8s-pod>.
print(f"notify-email: sending {palette['key']} to {to_addr} via {smtp_host}:{smtp_port}", file=sys.stderr) print(f"notify-email: sending {palette['key']} to {to_addr} via {smtp_host}:{smtp_port}", file=sys.stderr)
with smtplib.SMTP(smtp_host, smtp_port, timeout=15) as s: with smtplib.SMTP(smtp_host, smtp_port, local_hostname="ci.fritzlab.net", timeout=15) as s:
s.send_message(msg) s.send_message(msg)
print("notify-email: sent", file=sys.stderr) print("notify-email: sent", file=sys.stderr)
return 0 return 0