From ce0e9ab12a9cb534126f0dadd57ec96f8e9e5111 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Fri, 31 Jul 2026 11:37:11 +0200 Subject: [PATCH] gate4: fix SMTP TLS mode for port 465 (implicit TLS instead of STARTTLS) --- app/core/jobs.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/core/jobs.py b/app/core/jobs.py index aca10c4..717bd36 100644 --- a/app/core/jobs.py +++ b/app/core/jobs.py @@ -133,14 +133,17 @@ async def send_password_reset_email( msg.attach(MIMEText(text_body, "plain", "utf-8")) msg.attach(MIMEText(html_body, "html", "utf-8")) - # Send via SMTP + # Send via SMTP (port 465 = implicit TLS, port 587 = STARTTLS) + use_tls = settings.smtp_port == 465 + start_tls = settings.smtp_use_tls and not use_tls await aiosmtplib.send( msg, hostname=settings.smtp_host, port=settings.smtp_port, username=settings.smtp_username, password=settings.smtp_password, - start_tls=settings.smtp_use_tls, + use_tls=use_tls, + start_tls=start_tls, ) logger.info("Password reset email sent to %s for user %s", email, user_id)