fix: v0.5.2 - SMTP TLS/STARTTLS automatisch anhand Port (465/587)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ppfeiffer 2026-02-16 20:05:26 +01:00
parent 49e8b409bd
commit 7e441a8ade
2 changed files with 14 additions and 4 deletions

View file

@ -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)

View file

@ -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)