fix(email): add required Date header to outbound mail

This commit is contained in:
Christian Scheid
2026-04-24 15:05:31 +02:00
committed by Teknium
parent a9033c9220
commit 75b460bc94
3 changed files with 12 additions and 0 deletions

View File

@@ -1075,6 +1075,7 @@ async def _send_email(extra, chat_id, message):
"""Send via SMTP (one-shot, no persistent connection needed)."""
import smtplib
from email.mime.text import MIMEText
from email.utils import formatdate
address = extra.get("address") or os.getenv("EMAIL_ADDRESS", "")
password = os.getenv("EMAIL_PASSWORD", "")
@@ -1092,6 +1093,7 @@ async def _send_email(extra, chat_id, message):
msg["From"] = address
msg["To"] = chat_id
msg["Subject"] = "Hermes Agent"
msg["Date"] = formatdate(localtime=True)
server = smtplib.SMTP(smtp_host, smtp_port)
server.starttls(context=ssl.create_default_context())