Document compose-safe DEFAULT_FROM_EMAIL quoting.
Docker Compose .env rejects "Name" <addr>; prefer a bare address or one pair of quotes around the whole From value.
This commit is contained in:
@@ -221,10 +221,18 @@ def format_from_email(address: str | None, display_name: str | None = None) -> s
|
||||
|
||||
Bare ``noreply@…`` shows as "noreply". Prefer
|
||||
``"Monica Dhillon" <noreply@…>`` (RFC 5322).
|
||||
|
||||
Docker Compose ``.env`` cannot parse split quotes like
|
||||
``"Name" <addr>`` — use a bare address (this helper adds SITE_NAME)
|
||||
or one pair of quotes around the whole value:
|
||||
``DEFAULT_FROM_EMAIL="Monica Dhillon <addr@domain>"``.
|
||||
"""
|
||||
raw = (address or "").strip()
|
||||
if not raw:
|
||||
return ""
|
||||
# Strip a single layer of wrapping quotes from env/compose.
|
||||
if len(raw) >= 2 and raw[0] == raw[-1] and raw[0] in {'"', "'"}:
|
||||
raw = raw[1:-1].strip()
|
||||
if "<" in raw and ">" in raw:
|
||||
return raw
|
||||
name = (display_name or SITE_NAME or "").strip()
|
||||
|
||||
Reference in New Issue
Block a user