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:
parent
49e8b409bd
commit
7e441a8ade
|
|
@ -1,5 +1,9 @@
|
||||||
# Changelog
|
# 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
|
## [0.5.1] - 2026-02-16
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fernet key setup fuer EncryptedCookieStorage korrigiert (doppelte Base64-Kodierung)
|
- Fernet key setup fuer EncryptedCookieStorage korrigiert (doppelte Base64-Kodierung)
|
||||||
|
|
|
||||||
|
|
@ -115,13 +115,16 @@ async def send_verification_email(db, email: str, token: str):
|
||||||
msg["To"] = email
|
msg["To"] = email
|
||||||
msg.attach(MIMEText(html_body, "html"))
|
msg.attach(MIMEText(html_body, "html"))
|
||||||
|
|
||||||
|
smtp_port = config.get("smtp.port", 587)
|
||||||
|
use_tls = smtp_port == 465
|
||||||
await aiosmtplib.send(
|
await aiosmtplib.send(
|
||||||
msg,
|
msg,
|
||||||
hostname=smtp_host,
|
hostname=smtp_host,
|
||||||
port=config.get("smtp.port", 587),
|
port=smtp_port,
|
||||||
username=config.get("smtp.user", ""),
|
username=config.get("smtp.user", ""),
|
||||||
password=config.get("smtp.password", ""),
|
password=config.get("smtp.password", ""),
|
||||||
start_tls=True,
|
use_tls=use_tls,
|
||||||
|
start_tls=not use_tls,
|
||||||
)
|
)
|
||||||
await db.log_email(email, subject, "sent")
|
await db.log_email(email, subject, "sent")
|
||||||
logger.info("Verification email sent to %s", email)
|
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["To"] = email
|
||||||
msg.attach(MIMEText(html_body, "html"))
|
msg.attach(MIMEText(html_body, "html"))
|
||||||
|
|
||||||
|
smtp_port = config.get("smtp.port", 587)
|
||||||
|
use_tls = smtp_port == 465
|
||||||
await aiosmtplib.send(
|
await aiosmtplib.send(
|
||||||
msg,
|
msg,
|
||||||
hostname=smtp_host,
|
hostname=smtp_host,
|
||||||
port=config.get("smtp.port", 587),
|
port=smtp_port,
|
||||||
username=config.get("smtp.user", ""),
|
username=config.get("smtp.user", ""),
|
||||||
password=config.get("smtp.password", ""),
|
password=config.get("smtp.password", ""),
|
||||||
start_tls=True,
|
use_tls=use_tls,
|
||||||
|
start_tls=not use_tls,
|
||||||
)
|
)
|
||||||
await db.log_email(email, subject, "sent")
|
await db.log_email(email, subject, "sent")
|
||||||
logger.info("Reset email sent to %s", email)
|
logger.info("Reset email sent to %s", email)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue