# MailRules

MailRules is a self-hosted ai app. Sorts incoming email over IMAP, in real time, using rules you write in plain English or as structured conditions - a self-hosted mail filter with an AI model deciding which rule an email matches. It is open source and self-hosted, installable on Unraid.

Canonical page: https://ourlocalhost.com/app/8921/mailrules

## Description

Sorts incoming email over IMAP, in real time, using rules you write in plain English or as structured conditions - a self-hosted mail filter with an AI model deciding which rule an email matches. Works with any IMAP mailbox that signs in with a password or app password (iCloud, Gmail, Fastmail, Yahoo, Zoho, your own server). Outlook.com and Microsoft 365 are not supported by the self-hosted build. Choose the model that decides: a local Ollama server on your LAN (nothing leaves your network), any OpenAI-compatible endpoint, Anthropic, or the hosted Jev/Clef models. Rules made only of conditions, and sender rules, need no model at all. It starts safe: dry-run is on, so it records what it would do and changes no mailbox until you switch dry-run off. It never deletes mail, and every action can be undone for 30 days.

## Platform availability

Available on 1 of 10 platforms: Unraid.

## Health score

46/100 (Fair), based on 3 of 4 factors.
- Maintained: 79 (last commit 26 days ago)
- Popular: 14 (4 GitHub stars)
- Easy to install: 20 (1 install platform, Docker image)

## Links

- Unraid: https://ca.unraid.net/apps/mailrules-0sey7n70y4i753?q=mailrules
- Official website: https://mailrules.app/
- GitHub: https://github.com/TurtleByte-IN/mailrules
- Documentation: https://mailrules.app/docs

## Common questions

### Will MailRules start changing my inbox immediately after I connect my mailbox?

No, dry-run is on initially. It records what it would do until you switch dry-run off.

### Do I have to create an app password, and will MailRules mark incoming mail as read?

You sign in with an app password. MailRules uses IMAP IDLE and reads without marking anything read.

### Can I use Ollama as the decision model instead of the other model providers?

Yes, the docs list Ollama and OpenAI-compatible endpoints as decision-model options. Rules made only of conditions do not need a model.

### How can I migrate or back up my rules between instances?

Rules can be exported as YAML and imported back.

### Do I need to configure a reverse proxy for local use?

MailRules listens on the local machine only by default. The security section covers putting it behind a reverse proxy when needed.

---
Source: Our Local Host (https://ourlocalhost.com/app/8921/mailrules), the self-hosted and open-source app directory.
