fix(email): add required Date header to send_message_tool._send_email

Adds RFC 5322 Date header to the _send_email tool path in tools/send_message_tool.py.

Issue #15160 noted that both gateway/platforms/email.py and tools/send_message_tool.py
construct MIMEMultipart/MIMEText messages without setting a Date header. RFC 5322
requires the Date header; mail filters reject messages that lack it.

PR #15207 fixed the gateway/platforms/email.py path but did not cover
tools/send_message_tool._send_email, which is used by the send_message tool
for cross-channel messaging.

This change adds msg["Date"] = formatdate(localtime=True) to _send_email,
mirroring the fix applied to the gateway email adapter.

Closes #15160
This commit is contained in:
ms-alan 2026-04-25 00:08:49 +08:00 committed by Teknium
parent 51dc98d314
commit 08b8465ca9

View file

@ -10,9 +10,10 @@ import json
import logging import logging
import os import os
import re import re
from typing import Dict, Optional
import ssl import ssl
import time import time
from email.utils import formatdate
from typing import Dict, Optional
from agent.redact import redact_sensitive_text from agent.redact import redact_sensitive_text