DEV Community

Dash Jin
Dash Jin

Posted on

MailSentry: An AI Email Secretary That Makes Sure You Never Miss What Matters

Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle Submission 💸

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle

What I Built

MailSentry — an AI email secretary with one job: important emails never get missed, noise never interrupts you.

Here's the problem I was living with: my money moves over email. Bank alerts, virtual card transactions, 2FA codes, security warnings, domain expiry notices — scattered across three mailboxes in two languages. The Gmail app badges them all the same. What finally pushed me to build this: a "new device login" warning from my crypto exchange that I only noticed hours later, buried under newsletters. I got lucky — it was my own proxy IP. Next time I might not be.

MailSentry sits in front of your inbox and does what a good human secretary would do:

  1. Receives every incoming email in real time
  2. Reads it with an open-weight LLM and distills it into three lines: a one-sentence summary, the key facts, and anything you need to do
  3. Pushes that digest to your phone (WeChat/WeCom) within seconds — plain text, glanceable, no app to open

The full original still gets forwarded to your real inbox. Nothing is lost; the noise just stops demanding your attention.

Who would pay for this? Cross-border sellers and freelancers drowning in English-language order, payment, and logistics emails they can't afford to miss — plus anyone whose bank and security alerts currently compete with 40 newsletters a day. I'm pricing it at ¥29/month (~$4). At that price the unit economics only work because the AI side costs me essentially nothing (more on that below).

Demo

WeCom push — the Worker digesting the DeepInfra October newsletter

Here's a real one. A newsletter email arrives — "October at DeepInfra: 50B tokens + agent tools" — and within seconds my phone buzzes with this, generated by Llama 3.2 3B:

💡 收到新邮件
主题: October at DeepInfra: 50B tokens + agent tools
来自: newsletter@deepinfra.com
DeepInfra在10月份推出50亿token,Agent工具和GTC Berlin会议。
DeepInfra在GTC Berlin会议上展出,提供50亿token,Hosted Agents和Sandbox工具。

  1. 参加GTC Berlin会议… 2. 应用DeepStart程序,获得50亿token。3. 使用Hosted Agents和Sandbox工具…

A long English newsletter compressed into three glanceable sections, in Chinese, before I'd even unlocked my phone. I never opened the email.

The irony isn't lost on me: the day before this digest arrived, I'd read that same email manually to figure out what it wanted from me. Now the machine does it in seconds. That's the whole product.

Live landing page: http://sgov.infiniuniverse.com:8080/mailsentry/ (single page, pricing included)

Code

https://github.com/joinbot/mail-to-wx

The whole Cloudflare path is a single Worker file (src/index.js) plus wrangler.jsonc. The moving parts:

  • Email Routing (Cloudflare) → triggers async email() on the Worker for every incoming message
  • postal-mime → parses raw MIME into subject/from/body, strips HTML to clean text, truncates to 2,000 chars so the model never chokes
  • Workers AI (@cf/meta/llama-3.2-3b-instruct) → the summarizer, prompted for strict plain-text output in a fixed 3-section format
  • WeCom webhook → pushes the digest as a text message
  • message.forward() → the original lands in the real inbox untouched

There's also a self-hosted variant: an n8n workflow that polls three mailboxes over IMAP every minute, runs the same triage logic, and pushes via the WeCom app API. Same product, zero Cloudflare dependency — I run this one in production today on a $0/month Oracle ARM box.

How I Built It

The core bet: the open-weight model is the product, not a feature. Everything is built around env.AI.run('@cf/meta/llama-3.2-3b-instruct',...):

const aiResponse = await env.AI.run('@cf/meta/llama-3.2-3b-instruct', {
messages: [
{ role: "system", content: `You are a senior email assistant. Analyze the email,
output in plain text only, no markdown. Format exactly:
<one-sentence summary>
<key facts, comma-separated>
<action items, or "none">`},
{ role: "user", content: `From: ${from}\nDate: ${date}\nSubject: ${subject}\n${cleanBody}`}
]
});
Enter fullscreen mode Exit fullscreen mode

Why Llama 3.2 3B and not something bigger? An email digest doesn't need reasoning depth — it needs speed, structure-following, and Chinese output. The 3B instruct model follows the fixed format reliably and handles the Chinese/English mixed input my mailboxes produce. If a future email type needs more muscle, the model name is one string — I can swap to a larger open model without touching anything else.

The unglamorous 80% of the work was email parsing, not AI: postal-mime for MIME edge cases (base64 attachments, pathological HTML newsletters that would blow up the context window), the 2,000-char truncation guard, and a plain-text-only output contract so the message renders correctly inside WeChat's limited formatting.

Why Does Open Innovation Matter?

Three reasons, all of which a closed API would have broken:

1. The business model only works because inference is ~free. At ¥29/month per user, paying per-token closed-API rates for every inbound email would eat the margin alive — especially since most emails are noise you still have to read before discarding. A tiny open model on Workers AI's free tier means my marginal cost per user is effectively zero. Open weights make the price point possible; the price point makes the side hustle possible.

2. Email is the most sensitive data I own, and I can prove where it goes. Bank statements, password resets, 2FA codes — I'm not sending those to a closed API I can't audit. With open weights, the model is a replaceable component: today it runs on Cloudflare's Workers AI; tomorrow the same prompt runs on Ollama on my own ARM server (my n8n variant is already architected for this). No code change, no vendor permission, no "trust us" required. Try negotiating that with a closed provider.

3. No lock-in on the one thing that matters. If a better Chinese-language open model drops next month, it's a one-line diff. My prompts, my parsing pipeline, my push infrastructure — none of it is coupled to any company's API shape or pricing whims. For a one-person side hustle, that's not ideology, it's survival: I can't afford a rug-pull.

My First User

Me. I've been dogfooding MailSentry since mid-October 2026 — first the n8n self-hosted version (three mailboxes, one-minute poll, WeCom push), which is what watches my bank and security emails today. The Cloudflare Worker version is the packaged, multi-user-ready evolution: no server to babysit, Email Routing instead of IMAP passwords, same 3-line digest.

Did I pay? I'm the developer and the customer, so the honest answer is: I pay myself in sleep. The landing page is live with real pricing — I'll update this post when the first stranger subscribes.


Built with open weights because the math, the privacy, and the independence all demanded it. Happy Hacktoberfest! 🎃

Top comments (0)