diff --git a/config/settings.py b/config/settings.py index b531b34..cad53bd 100644 --- a/config/settings.py +++ b/config/settings.py @@ -226,7 +226,13 @@ EMAIL_HOST_USER = os.getenv("EMAIL_HOST_USER", "") # set on deploy platform EMAIL_HOST_PASSWORD = os.getenv("EMAIL_HOST_PASSWORD", "") # set on deploy platform EMAIL_USE_TLS = os.getenv("EMAIL_USE_TLS", "true").lower() == "true" EMAIL_USE_SSL = os.getenv("EMAIL_USE_SSL", "false").lower() == "true" -DEFAULT_FROM_EMAIL = os.getenv("DEFAULT_FROM_EMAIL", "") +# === FROM-ADDRESS === +# Where outgoing emails appear to come from. If DEFAULT_FROM_EMAIL isn't +# explicitly set, fall back to the Gmail address we authenticate as — +# that's always a valid sender since it's the same account sending the email. +# Without this fallback, emails fail with "Invalid address ''" if the +# env var is missing, even though auth + SMTP are otherwise fine. +DEFAULT_FROM_EMAIL = os.getenv("DEFAULT_FROM_EMAIL", "") or EMAIL_HOST_USER CONTACT_EMAIL_TO = [ item.strip() for item in os.getenv("CONTACT_EMAIL_TO", DEFAULT_FROM_EMAIL).split(",")