feat: Implement email functionality with FastAPI-Mail and Mailhog

- Updated docker-compose.yml to include Mailhog service for email testing.
- Added environment variables for email configuration in docker-compose.
- Updated requirements.txt to include fastapi-mail for email support.
- Created templates for password reset, email verification, and welcome emails.
- Developed mail utility module to handle sending emails using FastAPI-Mail.
- Added documentation for email testing with Mailhog.
This commit is contained in:
Christian Krakau-Louis
2025-04-14 07:23:16 +02:00
parent 583f5aac42
commit 5cf3f944b1
22 changed files with 1425 additions and 157 deletions
+26 -1
View File
@@ -34,7 +34,19 @@ services:
DB_USER: "pubquiz_user"
DB_PASS: "pubquiz_pass"
PYTHONUNBUFFERED: "1"
LEAGUELEDGER_BASE_URL: "https://rover.leagueledger.net" # Base URL for QR codes
# Use environment variable from .env instead of hard-coding
LEAGUELEDGER_BASE_URL: ${LEAGUELEDGER_BASE_URL:-http://localhost:8000}
# Email configuration for Mailhog
MAIL_USERNAME: ""
MAIL_PASSWORD: ""
MAIL_FROM: "noreply@leagueledger.net"
MAIL_FROM_NAME: "LeagueLedger"
MAIL_PORT: 1025
MAIL_SERVER: "mailpit"
MAIL_STARTTLS: "False"
MAIL_SSL_TLS: "False"
MAIL_USE_CREDENTIALS: "False"
MAIL_VALIDATE_CERTS: "False"
command: uvicorn app.main:app --host 0.0.0.0 --reload
ports:
- "8000:8000"
@@ -55,4 +67,17 @@ services:
ports:
- "8001:80"
mailpit:
image: axllent/mailpit # Updated image name
container_name: pubquiz_mailpit
restart: unless-stopped
ports:
- "8025:8025" # Web UI
- "1025:1025" # SMTP Server
environment:
MH_STORAGE: "memory" # Store emails in memory (they will be lost on container restart)
MH_UI_WEB_PATH: "/" # Base path for the web UI
networks:
- default
# No persistent volumes defined - database will reset when container stops