feat(slice-4): SmtpMailer — real mail over a configured relay, log-hygienic (INV-8, §6.6)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -36,5 +36,35 @@ def cookie_secure() -> bool:
|
||||
|
||||
|
||||
def mailer_kind() -> str:
|
||||
"""Which mailer adapter to build: 'log' (dev/tests) or 'smtp' (deployed; SLICE-4)."""
|
||||
"""Which mailer adapter to build: 'log' (dev/tests) or 'smtp' (deployed)."""
|
||||
return os.environ.get("ECOMM_MAILER") or "log"
|
||||
|
||||
|
||||
# SMTP relay coordinates (deployed envs only; INV-8 — host/port/user/from are non-secret
|
||||
# overlay values, the password is a Secret Manager reference resolved by the deploy).
|
||||
|
||||
|
||||
def smtp_host() -> str:
|
||||
return os.environ.get("ECOMM_SMTP_HOST", "")
|
||||
|
||||
|
||||
def smtp_port() -> int:
|
||||
return int(os.environ.get("ECOMM_SMTP_PORT") or "587")
|
||||
|
||||
|
||||
def smtp_user() -> str:
|
||||
return os.environ.get("ECOMM_SMTP_USER", "")
|
||||
|
||||
|
||||
def smtp_password() -> str:
|
||||
return os.environ.get("ECOMM_SMTP_PASSWORD", "")
|
||||
|
||||
|
||||
def smtp_from() -> str:
|
||||
"""The From header; defaults to the relay user."""
|
||||
return os.environ.get("ECOMM_SMTP_FROM") or smtp_user()
|
||||
|
||||
|
||||
def smtp_starttls() -> bool:
|
||||
"""STARTTLS on the relay connection (default on; disable only for odd relays)."""
|
||||
return os.environ.get("ECOMM_SMTP_STARTTLS", "1").strip().lower() not in {"0", "false", "no", "off"}
|
||||
|
||||
Reference in New Issue
Block a user