fix: verify SMTP TLS in send_message_tool

Add regression coverage for the standalone email send path and pass an explicit default SSL context to STARTTLS for certificate verification, matching the gateway email adapter hardening salvaged from PR #994.
This commit is contained in:
teknium1
2026-03-14 06:31:52 -07:00
parent 344adc72a1
commit 71cffbfa4f
2 changed files with 6 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ import json
import logging
import os
import re
import ssl
import time
logger = logging.getLogger(__name__)
@@ -432,7 +433,7 @@ async def _send_email(extra, chat_id, message):
msg["Subject"] = "Hermes Agent"
server = smtplib.SMTP(smtp_host, smtp_port)
server.starttls()
server.starttls(context=ssl.create_default_context())
server.login(address, password)
server.send_message(msg)
server.quit()