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:
+5
-1
@@ -307,8 +307,12 @@ def main() -> int:
|
||||
msg.set_content(text)
|
||||
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)
|
||||
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)
|
||||
print("notify-email: sent", file=sys.stderr)
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user