Scan the org's mailboxes for a lead's past e-mail on request

FeatureEmailService
Shipped
August 21, 2026 at 3:35 AM UTC
Author
Kamo
Commit
db0b120

Serves the "Associate Past E-Mails w/ Lead" tick-box. Given a lead and the address just recorded on it, read INBOX and Sent of every mailbox in that lead's organisation back a year and attach anything carrying the address. Every guard the automatic path applies still applies, because both paths now share one classify(): an org whose addresses cannot be classified is refused, a purely internal thread is refused, and a company address is never a match candidate — so ticking the box on a lead whose e-mail is noreply@<org-domain> still associates nothing rather than handing that lead the company's whole mail stream. On top of those, the lead's own address has to actually be on the message. Runs off the request thread and single-threaded: a whole organisation's mailboxes take far longer to read than a lead save may block for, and the mail server allows only a handful of connections per user for the entire pod, so concurrency here would starve the live sweep rather than go faster. The endpoint answers 202 "queued", never "found something" — the member watches the Emails tab fill in. Folder selection moves to MailboxFolderScope so the sweep and the back-fill cannot drift on where mail lives; a timeline whose contents depended on which path found a message first would be worse than either.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing