""" Email configuration for thrillwiki project. This module configures email backends and settings using python-decouple for consistent environment variable management across the project. Why python-decouple? - Already used in base.py for consistency - Simpler API than django-environ - Sufficient for our configuration needs - Better separation of config from code """ from decouple import config # ============================================================================= # Email Backend Configuration # ============================================================================= # Choose the appropriate email backend based on your environment: # - Console: django.core.mail.backends.console.EmailBackend (development) # - ForwardEmail: django_forwardemail.backends.ForwardEmailBackend (production) # - SMTP: django.core.mail.backends.smtp.EmailBackend (custom SMTP) EMAIL_BACKEND = config( "EMAIL_BACKEND", default="django_forwardemail.backends.ForwardEmailBackend" ) # ============================================================================= # ForwardEmail Configuration # ============================================================================= # ForwardEmail is a privacy-focused email service that supports custom domains # https://forwardemail.net/ FORWARD_EMAIL_BASE_URL = config( "FORWARD_EMAIL_BASE_URL", default="https://api.forwardemail.net" ) FORWARD_EMAIL_API_KEY = config("FORWARD_EMAIL_API_KEY", default="") FORWARD_EMAIL_DOMAIN = config("FORWARD_EMAIL_DOMAIN", default="") # Server email address for sending system emails SERVER_EMAIL = config("SERVER_EMAIL", default="django_webmaster@thrillwiki.com") # ============================================================================= # SMTP Configuration # ============================================================================= # These settings are used when EMAIL_BACKEND is set to SMTP backend # Configure via individual environment variables or EMAIL_URL EMAIL_HOST = config("EMAIL_HOST", default="localhost") EMAIL_PORT = config("EMAIL_PORT", default=587, cast=int) EMAIL_USE_TLS = config("EMAIL_USE_TLS", default=True, cast=bool) EMAIL_USE_SSL = config("EMAIL_USE_SSL", default=False, cast=bool) EMAIL_HOST_USER = config("EMAIL_HOST_USER", default="") EMAIL_HOST_PASSWORD = config("EMAIL_HOST_PASSWORD", default="") # ============================================================================= # Email Timeout and Retry Settings # ============================================================================= # Timeout for email operations in seconds EMAIL_TIMEOUT = config("EMAIL_TIMEOUT", default=30, cast=int) # Default from email address DEFAULT_FROM_EMAIL = config( "DEFAULT_FROM_EMAIL", default="ThrillWiki " ) # ============================================================================= # Email Subject Prefix # ============================================================================= # Prefix added to the subject of emails sent by Django admin EMAIL_SUBJECT_PREFIX = config("EMAIL_SUBJECT_PREFIX", default="[ThrillWiki] ")