From 08b8465ca9b68de4e5fde406f0e8ca94bab7ced6 Mon Sep 17 00:00:00 2001 From: ms-alan Date: Sat, 25 Apr 2026 00:08:49 +0800 Subject: [PATCH] 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 --- tools/send_message_tool.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/send_message_tool.py b/tools/send_message_tool.py index b4de998fe5..938cb977b6 100644 --- a/tools/send_message_tool.py +++ b/tools/send_message_tool.py @@ -10,9 +10,10 @@ import json import logging import os import re -from typing import Dict, Optional import ssl import time +from email.utils import formatdate +from typing import Dict, Optional from agent.redact import redact_sensitive_text