Add Gmail-DWD send path for the digest mailer (v0.1.0:76)
The box's existing service-account domain-wide-delegation grant already includes gmail.compose, which authorizes users.messages.send — verified 2026-06-15 by a token-mint probe and a live messages.send to grant. So CRM-originated mail can send through the account that already powers email capture: no SMTP account, no app password, no admin change. - backend/email_integration/gmail_send.py: send_via_gmail() impersonates a domain user and POSTs users.messages.send (reuses credentials.py + the compose scope; mirrors compose.py's REST pattern). - backend/digest_mailer.py: send_digest() prefers Gmail DWD when enabled, falls back to smtp_send otherwise. Sender = CRM_DIGEST_SENDER else first active admin. - server.py: the admin test endpoint now routes through digest_mailer (so the Settings button sends via DWD on the box with zero SMTP config). Recipient restriction to the admin set and no-leak error handling preserved. - test_gmail_send.py: build/send + transport routing (provider + urlopen faked). 19/19 backend green; s9pk typechecks. SMTP (v75) stays as the fallback transport. Send-path decision + scope finding recorded in ROADMAP.md and AGENTS.md.
This commit is contained in:
+8
-1
@@ -20,7 +20,14 @@ X_API_KEY=
|
||||
CRM_DB_PATH=./data/crm.db
|
||||
CRM_DEV_DB_PATH=./data/crm_dev.db
|
||||
|
||||
# ── Daily-digest outbound SMTP (dev override of the per-package mailbox) ──
|
||||
# ── Daily-digest sender ──
|
||||
# The digest mailer prefers Gmail domain-wide delegation (the service account that
|
||||
# already powers email capture; its grant includes gmail.compose, which can send) and
|
||||
# falls back to SMTP below. For the Gmail/DWD path it sends impersonating this domain
|
||||
# user; if unset, it uses the first active admin's email.
|
||||
CRM_DIGEST_SENDER=
|
||||
|
||||
# ── Daily-digest outbound SMTP fallback (dev override of the per-package mailbox) ──
|
||||
# On the Start9 box these are set by the "Configure Digest SMTP" action (written
|
||||
# to /data/secrets/smtp/* and exported by docker_entrypoint.sh). For dev, set them
|
||||
# here. SMTP_SECURITY is one of: starttls (587) | tls (465) | none.
|
||||
|
||||
Reference in New Issue
Block a user