Skip to content

Email forwarding: keep only mail about job applications - #196

Merged
Sam-Razavi merged 1 commit into
mainfrom
dev
Nov 15, 2026
Merged

Sam-Razavi merged 1 commit into
mainfrom
dev

Conversation

@Sam-Razavi

@Sam-Razavi Sam-Razavi commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

What was wrong

People forward their whole inbox, and every email that arrived was stored and shown in the Inbox tab: newsletters, receipts, delivery notices. One of them, a parcel notice from shipment-tracking@amazon.se, was matched to an Amazon application because the sender domain is the company's.

What changes

  • services/inbound_email/relevance.py (pure, no database) decides whether an email is about a job application. It is kept when it has a confident rejection, interview or offer wording; uses job-application wording (English or Swedish); matches a tracked application; or comes through a recruiting system. It is dropped when the subject is about an order, delivery or payment, or when it is bulk mail not tied to an application the user tracks.
  • Bulk mail is recognised in the webhook from the message headers (List-Unsubscribe, List-Id, Precedence: bulk and similar), the sender address and unsubscribe wording in the text. The flag is computed there because headers do not cross the queue.
  • Dropped mail is not stored at all. The task returns ignored and logs the reason and sender domain, no content.
  • Migration 0036 deletes stored emails that fail the same test. It only touches rows nobody acted on (no detected decision, suggestion state none) and keeps Gmail's forwarding confirmation, which Settings reads. Deleted rows cannot be restored.
  • Privacy policy section 6 now says that unrelated mail is discarded on arrival.

Checks

  • tests/test_inbound_email_relevance.py: the nine emails that filled a real inbox (newsletters, a housing-swap notice, the Amazon parcel notice, a job-alert digest, a private message) are all dropped; eight job emails (application confirmations in English and Swedish, a recruiter's personal message, a rejection, an interview invitation, mail through an ATS) are all kept.
  • Task and webhook tests for the "ignored, not stored" path and the bulk flag.
  • Migration run on a real Postgres with six seeded rows: three noise rows deleted; the job email, the Gmail confirmation and a dismissed suggestion kept.
  • Backend: 1,000 tests, ruff and mypy clean. Frontend: lint, type-check and 391 tests pass.

Not solved here

Production logs show only about ten deliveries to the webhook in four days, all accepted. Mail the user expects but never sees is not reaching ApplyLuma at all, so the cause is upstream (the forwarding rule in the mail account, or Mailgun), not in this code.

People forward their whole inbox, so every newsletter, receipt and delivery
notice was stored and shown in the Inbox, and a parcel notice from amazon.se
was matched to an Amazon application by its sender domain.

- relevance.py decides whether an email is about a job application: a
  confident rejection/interview/offer, job wording, a match to a tracked
  application, or a recruiting-system sender. Shop and delivery subjects and
  bulk mail not tied to an application are dropped.
- Dropped mail is not stored at all.
- Migration 0036 deletes stored noise that nobody acted on. Gmail's
  forwarding confirmation and anything with a detected decision are kept.
- Privacy policy says what is not kept.
@vercel

vercel Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
applyluma Ready Ready Preview Nov 15, 2026 5:33am UTC

@Sam-Razavi
Sam-Razavi merged commit 1f12daa into main Nov 15, 2026
10 checks passed

This branch was successfully deployed

1 active deployment
Preview — d1d44ab3 Deployed Nov 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant