Files
TK-Wiki-Newsletter/app/core/email_utils.py
smueller 7788c74cfe Refactor configuration and security features for improved development experience
- Updated the .env.example file to reflect a development environment setup with enhanced secret key requirements and local host settings.
- Modified the Docker Compose configuration to enhance security with read-only settings and no-new-privileges options.
- Updated requirements.txt to pin package versions for better dependency management.
- Enhanced the FastAPI application to include dynamic OpenAPI and documentation URLs based on the environment.
- Implemented session versioning in JWT tokens to improve security and user session management.
- Added new validation for user roles and password strength in schemas.
- Improved email sending logic to handle recipient lists more robustly and added logging for SMTP operations.
- Updated dashboard and profile templates to reflect new features and improve user experience.
2026-07-07 16:31:10 +02:00

17 lines
492 B
Python

from pydantic import EmailStr, TypeAdapter
_email_adapter = TypeAdapter(EmailStr)
def parse_recipient_list(raw: str) -> list[str]:
recipients: list[str] = []
for part in raw.split(","):
addr = part.strip()
if not addr:
continue
if any(ch in addr for ch in ("\n", "\r", "\0")):
raise ValueError(f"Ungültige E-Mail-Adresse: {addr!r}")
_email_adapter.validate_python(addr)
recipients.append(addr)
return recipients