I'd be pretty concerned about prompt injection risks with feeding a LLM unsanitized data. You definitely need a good harness around it..
post
You definitely don’t have to go full LLM for this. There are a wide variety of local spam filtering tools available, depending on what email application you use. If you really want to use modern ML, I’d go with something like Laya as it is tunable and runs locally.
I would recommend using a classifier model instead of a text generation one.
As for the way to do it a simple program that connects to you mailbox via imap and calls the vllm or whatever api you are using and then moves it to spam could work?
LLM plugins should be available in standard spamfilters like Rspamd. Some mail servers like Stalwart have it as well. You pick a prompt and provide it with an OpenAI-compatible endpoint and it'll ask the AI for every mail. Can be a local model.
Not sure if it's in the Email clients as well. I found a few Thunderbird addons, but that was just a quick Google search.
If your email service offers an MCP connection (Google does), you can have your AI connect and examine emails and manipulate them. You can hook that up to qwen using maybe lmstudio. I haven't tried it self-hosted, but it sounds pretty straightforward.
Probably better to ask this in an ai community. However fwiw there are a few skills for generic imap checking. I've set up a local openclaw gateway and model with an automated task to check my email in the morning and basically prod me into replying. The same concept should be applicable to spam detection too.
The morning nudge is a good boundary for automation. A digest that points at the message is very different from a bot that silently edits the mailbox while you sleep.
OP if you don't mind running this through a Hermes / OpenClaw harness this is probably the easiest way with pre built email connectors. Also if you don't mind spending a few bucks a month DeepSeek v4 will blow out anything you run locally for pennies (or gpt luna as of last wed.)
It can also set up its own custom connector if needed and run as needed via CRON.
The ability to do it aside, if feel it should be brought up that handing off things like this can lead to giving anything that gets through an “unofficial seal of approval” so to speak.
“This email looks phishy, but AI says it’s safe so I’ll ignore my initial concerns” is going to inevitably happen.
There’s also the fact that using a model to detect scams, means you can use that same model to train a different model on how to build scams that bypass the detection.
This also feels a little like a hammer looking for a nail. There have been tools to handle this without the insane computational requirements of an LLM for many years.
all 14 comments