From 7e441a8adec7a8a254c0895937178beec706cadb Mon Sep 17 00:00:00 2001 From: ppfeiffer Date: Mon, 16 Feb 2026 20:05:26 +0100 Subject: [PATCH] fix: v0.5.2 - SMTP TLS/STARTTLS automatisch anhand Port (465/587) Co-Authored-By: Claude Opus 4.6 --- CHANGELOG.md | 4 ++++ meshbot/auth.py | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34b8feb..3cf3d63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [0.5.2] - 2026-02-16 +### Fixed +- SMTP-Versand: TLS (Port 465) und STARTTLS (Port 587) automatisch anhand des Ports + ## [0.5.1] - 2026-02-16 ### Fixed - Fernet key setup fuer EncryptedCookieStorage korrigiert (doppelte Base64-Kodierung) diff --git a/meshbot/auth.py b/meshbot/auth.py index 5dba912..4a12571 100644 --- a/meshbot/auth.py +++ b/meshbot/auth.py @@ -115,13 +115,16 @@ async def send_verification_email(db, email: str, token: str): msg["To"] = email msg.attach(MIMEText(html_body, "html")) + smtp_port = config.get("smtp.port", 587) + use_tls = smtp_port == 465 await aiosmtplib.send( msg, hostname=smtp_host, - port=config.get("smtp.port", 587), + port=smtp_port, username=config.get("smtp.user", ""), password=config.get("smtp.password", ""), - start_tls=True, + use_tls=use_tls, + start_tls=not use_tls, ) await db.log_email(email, subject, "sent") logger.info("Verification email sent to %s", email) @@ -158,13 +161,16 @@ async def send_reset_email(db, email: str, token: str): msg["To"] = email msg.attach(MIMEText(html_body, "html")) + smtp_port = config.get("smtp.port", 587) + use_tls = smtp_port == 465 await aiosmtplib.send( msg, hostname=smtp_host, - port=config.get("smtp.port", 587), + port=smtp_port, username=config.get("smtp.user", ""), password=config.get("smtp.password", ""), - start_tls=True, + use_tls=use_tls, + start_tls=not use_tls, ) await db.log_email(email, subject, "sent") logger.info("Reset email sent to %s", email)