3.34 Email Deliverability: Intercom Spam Resolution — RAIA (Real estate Artificial Intelligence Agent) Documentation
How ADR-302 permanently fixed the SPF/DMARC forwarding failure that sent legitimate property enquiries to Intercom's spam folder. Intercom ticket #123363364.
How ADR-302 permanently fixed the SPF/DMARC forwarding failure that sent legitimate property enquiries to Intercom's spam folder. Intercom ticket #123363364.
Published 2026-08-10 · Incident Capture · ADR-302 · Status: Resolved in production
Tier 1 Plain English (ELI5)
ELI5 — Anyone
The postbox at the old address (enquiries@rentlondonflat.com) used to forward letters through a different postal service (Intercom).
That other service's postman didn't recognise the sender's stamp — so some letters went straight into the bin (spam folder) before anyone could read them.
We changed it: the postbox now forwards letters to our own sorting office
(raia-inbound@mail.estateaigents.com) — same postal company (Google Workspace),
so every stamp is recognised and no letters get binned. Legitimate property enquiries land in the inbox, every time.
Property enquiries sent to enquiries@rentlondonflat.com no longer disappear into a spam folder. The fix is live, verified in production, and requires no action from estate agent staff.
Tier 2 User Guide — What Changed for Staff
User Guide — Estate Agent StaffBefore the fix, property enquiry emails sent to enquiries@rentlondonflat.com sometimes arrived in Intercom's spam folder instead of the conversations list. The Intercom support team (ticket #123363364) provided a manual workaround: mark the email as not spam, add the sender to contacts, and send a reply to train the algorithm. This was not a permanent fix.
As of August 2026, the underlying pipe has been changed. Here is what staff need to know:
-
✓Legitimate enquiries are no longer silently lost
Emails from landlords, tenants, and prospective applicants routed through enquiries@rentlondonflat.com now flow into the RAIA (Real estate Artificial Intelligence Agent) Universal Inbox reliably. No spam bin. No manual rescue steps.
-
✓The old address still works — nothing for senders to change
enquiries@rentlondonflat.com is permanent. Senders never need to update their address book. The change happened behind the scenes at the infrastructure level.
-
✓Replies still go out from hello@rentlondonflat.com
Staff replies sent from the Universal Inbox Composer appear to senders as coming from hello@rentlondonflat.com — the branded Sovereign Pilot Agency address. Nothing changes for the recipient.
-
!Intercom is still used for accounts@ (billing and tenancy)
Emails sent to accounts@rentlondonflat.com continue to route directly to Intercom. This address is not yet part of the new pipe. If you use Intercom for billing or accounts queries, continue as normal.
Production Status (as of 2026-08-10)
| Address | Route | Status |
|---|---|---|
enquiries@rentlondonflat.com |
→ Google Workspace collector → RAIA (Real estate Artificial Intelligence Agent) Universal Inbox | ✅ Live |
hello@rentlondonflat.com |
Reply-from address (Send As on collector) | ✅ Live |
accounts@rentlondonflat.com |
→ Intercom (unchanged) | ⚠ Intercom — not yet migrated |
accounts@rentlondonflat.com is not in the forwarding set and continues to route to Intercom. This is intentional until Intercom is fully retired. The spam risk on that address remains, and the manual Intercom workaround (mark not-spam, add to contacts) still applies for that mailbox only. Full resolution requires decommissioning Intercom.
Tier 3 Developer Guide — Root Cause
Developer Guide — EngineeringSPF/DMARC Forwarding Alignment Failure
The legacy pipe routed all inbound email through Google's auto-forward to Intercom's SMTP infrastructure (intercom-mail.com). This cross-domain forwarding broke SPF/DMARC alignment — a well-known failure mode documented in RFC 7489 and the primary reason for SRS (Sender Rewriting Scheme).
When a landlord sends email to enquiries@rentlondonflat.com and Gmail auto-forwards it to Intercom, the receiving Intercom server checks the sender's SPF record. It sees that the Gmail forwarding server's IP is not authorised to send mail on behalf of the landlord's domain. Without SRS, the email fails SPF checks and is instantly flagged as junk. The DMARC alignment check then also fails because the From: domain doesn't match the RFC5321.MailFrom domain of the forwarded message.
The Intercom engineering team's response was a manual runbook: mark as not-spam → add sender to contacts → reply to train Gmail's filter. This is a human-time sink, not a technical fix, and fails silently for any sender who isn't proactively discovered in the spam folder.
Why SRS Was Not Applied
SRS (Sender Rewriting Scheme) would have rewritten the envelope sender to a rentlondonflat.com address, preserving SPF alignment through the hop. Gmail's auto-forward feature does not apply SRS. Google Workspace does not offer server-side SRS configuration for auto-forwarding rules. The only Google-native path that preserves SPF alignment is forwarding within the same trust domain.
Tier 3 Architecture Fix (ADR-302)
ADR-302 replaced the Intercom forwarding pipe entirely. The new architecture forwards from enquiries@rentlondonflat.com to a Google Workspace collector mailbox on the same trust domain. Gmail-to-Gmail forwarding is handled internally by Google's infrastructure — SPF and DMARC remain aligned because neither hop leaves Google's MTA.
New Email Pipe — Address Roles
| Address | Role | Note |
|---|---|---|
enquiries@rentlondonflat.com |
Legacy inbound — auto-forwards to collector | Immortal; never decommission. All historical conversations attached here. |
rentlondonflat@mail.estateaigents.com |
Org alias on the RAIA (Real estate Artificial Intelligence Agent) collector mailbox | Destination of the Gmail-to-Gmail forward. Free Workspace alias. |
raia-inbound@mail.estateaigents.com |
Collector mailbox — sole GMAIL_IMPERSONATE_EMAIL poll target |
gmail-sync polls this via DWD. Active since 2026-08-05 pipe flip. |
hello@rentlondonflat.com |
Reply-from address (Send As on collector) | Set via GMAIL_REPLY_FROM env var. Added 2026-08-07. |
accounts@rentlondonflat.com |
Intercom direct — NOT in forwarding set | ⚠ Excluded — see Caveat below. |
Why Gmail-to-Gmail Preserves SPF/DMARC
When both the forwarding mailbox (enquiries@rentlondonflat.com on Google Workspace) and the destination (raia-inbound@mail.estateaigents.com on Google Workspace) are part of the same underlying Google infrastructure, Google routes the message internally. The MTA hop never leaves Google's network boundary, so:
- The envelope sender domain is verified against Google's own SPF records, which are always valid for Google-originated mail.
- DMARC alignment is maintained because the
From:domain and the authenticated domain share a Google trust anchor. - No SRS rewrite is required — the internal routing bypasses the SPF-break problem entirely.
Tier 3 Anti-Spam Filter
To further guard against the collector inbox itself being mis-labelled, a dedicated Gmail filter was created on raia-inbound@mail.estateaigents.com:
Filter criterion: deliveredto:rentlondonflat@mail.estateaigents.com
Action: Never send to spam
One filter per org alias. This is a belt-and-braces guard — even if Gmail's heuristics misclassify a forwarded message, this filter overrides it for any email that arrived via the Sovereign Node org alias.
This filter is scoped by the Delivered-To: header, which Google Workspace populates with the alias address that received the message. The METADATA_HEADERS array in gmail.ts must include 'Delivered-To' for this header to be available in the Gmail API response for per-org routing in tbl_org_inbound_addresses.
Tier 3 Dedup Gate (tbl_email_dedup)
Because the Gmail-to-Gmail forward creates a new Gmail Message-ID for the forwarded copy, a naive external_message_id check would fail to catch duplicates if the collector ever received both the forwarded copy and a direct copy of the same email. The dedup gate uses the RFC 2822 Message-ID header instead — this is set by the originating mail client and survives all forwarding hops unchanged.
Dedup Schema
-- tbl_email_dedup (V320 migration)
CREATE TABLE tbl_email_dedup (
id BIGSERIAL PRIMARY KEY,
rfc_message_id TEXT UNIQUE NOT NULL, -- RFC 2822 Message-ID from originating client
conversation_id UUID REFERENCES tbl_conversations(conversation_id) ON DELETE SET NULL,
created_at TIMESTAMPTZ DEFAULT now()
);
Code Flow
gmail-syncfetches the thread via the Gmail API, extractingMessage-IDfromMETADATA_HEADERS.- Before any DB insert,
classifyEmailJunk()runs on the thread — spam classification gate. - The route checks
tbl_email_dedupfor therfc_message_id. If found → skip (ThreadResult.skipped = 'dedup'). - If not found → insert conversation → write
rfc_message_idrow totbl_email_dedup.
163 total entries in tbl_email_dedup. 42 dedup gate fires in the last 24 hours — confirming the dedup mechanism is healthy and actively preventing duplicate conversation creation from forwarded copies and any potential retry loops.
Tier 3 Production Verification
All checks were run on 2026-08-10 against the live Supabase production database and Vercel environment.
| Check | Result | Method |
|---|---|---|
| Total Sovereign Node conversations in prod | 36,077 | SELECT COUNT(*) FROM tbl_conversations |
| New conversations ingested today | 35 | Filtered by created_at >= today() |
| Last gmail-sync import | 13:39 (minutes before verification) | Vercel cron log |
| Spam/junk pattern in inbound stream | 0 flagged | classifyEmailJunk() log scan |
| Dedup gate — total entries | 163 | SELECT COUNT(*) FROM tbl_email_dedup |
| Dedup gate — last 24 h fires | 42 | Filtered by created_at >= now() - interval '24h' |
| GMAIL_IMPERSONATE_EMAIL (Vercel prod) | raia-inbound@mail.estateaigents.com |
vercel env ls |
| Forwarding path: enquiries@ → raia-inbound@ | Flowing — no anomalies | Manual smoke test + Delivered-To header verified |
Tier 3 Caveat: accounts@ Is Not Yet Migrated
accounts@rentlondonflat.com is explicitly excluded from the forwarding set and is not present in tbl_org_inbound_addresses. It continues to route directly to Intercom (intercom-mail.com), meaning the SPF/DMARC forwarding alignment failure described above still applies to billing, tenancy, and accounts correspondence on that address.
The accounts@ exclusion is intentional — adding it to the forwarding set while Intercom is still the operational platform would create duplicate conversation paths and confuse the legacy Intercom team. Full resolution requires Intercom to be decommissioned. Until then, the manual spam-rescue runbook (mark not-spam → add sender to contacts) remains in force for accounts@ only.
Do Not Forward accounts@ Until Intercom Is Retired
Any change to GMAIL_IMPERSONATE_EMAIL, the collector alias set, or tbl_org_inbound_addresses has zero blast radius on accounts@ — the address is explicitly absent from all forwarding configuration. Do not add it without a formal Intercom retirement decision and decommission plan.
Tier 3 Health Monitoring
Silence on the inbound stream is the primary operational risk — a forwarding rule break at Gmail or a DWD scope revocation would produce no error, just no new conversations. The health monitoring design uses time-based silence detection:
| Silence Window | Action | Target |
|---|---|---|
| 48 hours | Internal alert (Slack / Hermes PA notification) | Engineering team |
| 72 hours | Email alert to agency admin | eugin.song@rentlondonflat.com |
The health cron (tbl_org_email_health — V320 migration) was deferred in the initial ADR-302 build. It is the next task in the email pipeline roadmap. Until it is live, monitor manually via the Vercel cron log and the production conversation count.
1. Check Vercel cron log for the most recent gmail-sync execution timestamp.
2. Run: SELECT COUNT(*), MAX(created_at) FROM tbl_conversations WHERE created_at >= now() - interval '24h'
3. If count = 0 and last sync was > 6 hours ago — investigate gmail-sync DWD auth and forwarding rule health in Gmail settings.
References References & External Sources
| Source | Type | Notes |
|---|---|---|
| ADR-302 — Multi-Tenant Email Org Inbound | Architecture Decision Record | Governing ADR. Defines the Gmail-to-Gmail forwarding pattern, collector mailbox architecture, anti-spam filter spec, dedup gate design, and reply-from configuration. Accepted 2026-08-05, commit a05982e6. |
| RUNBOOK-email-cutover-workspace-steps | Operations Runbook | Step-by-step workspace operations for the ADR-302 pipe flip: subdomain setup, collector creation, DWD grant, alias provisioning, anti-spam filter configuration, smoke test, and forwarding switch. Referenced for the 2026-08-05 cutover. |
| Intercom Support Ticket #123363364 | Vendor Support Ticket | The original Intercom ticket that surfaced the SPF/DMARC spam problem. Intercom's response was a manual runbook (not spam + add to contacts + reply to train). Confirmed root cause: forwarding to intercom-mail.com breaks SPF alignment. No permanent technical fix from vendor. |
| 3.31 Multi-Tenant Email Architecture (ADR-302) | RAIA (Real estate Artificial Intelligence Agent) Documentation | The comprehensive architecture page covering all ADR-302 implementation detail: address role table, build order, reply-from env vars, dedup schema, org routing table, and multi-agency scale design. Read alongside this page for full system context. |
| RFC 7489 — DMARC | IETF Standard | Defines the DMARC policy framework. Section 8.5 specifically covers indirect mail flows (forwarding) and the SPF alignment break — the technical root cause of the Intercom spam problem. |
| RFC 2822 — Internet Message Format | IETF Standard | Defines the Message-ID header used as the dedup key in tbl_email_dedup. The Message-ID is set by the originating mail client and survives forwarding hops unchanged, making it the correct dedup key — not the Gmail thread ID which is mailbox-scoped. |