
Deploy Paperless-ngx Mail Rules
Auto-file email attachments with IMAP mail rules
paperless-ngx
Just deployed
/usr/src/paperless/data
Just deployed
/var/lib/postgresql/data
Redis
Just deployed
/data
Deploy and Host self hosted Paperless-ngx Mail Rules (Open-Source Receipt and Invoice Archive) on Railway
Paperless-ngx turns e-mailed invoices and photographed receipts into a searchable OCR archive. I rely on its mail rules: add an IMAP account, match an invoice sender, and Paperless consumes, tags, and files the PDF. Railway runs Paperless-ngx 3.3.0, Postgres, and Redis.
About Hosting Paperless-ngx Mail Rules open-source software on Railway (self hosted Paperless-ngx receipt management template)
Paperless-ngx is a GPL-3.0 archive with OCR, tags, correspondents, types, custom fields, workflows, saved views, and IMAP rules. This template runs ghcr.io/paperless-ngx/paperless-ngx:3.3.0 with Postgres and Redis, volume /usr/src/paperless/data. Admin credentials and secret key are Railway variables. v3 uses Tantivy search.
Why Deploy Paperless-ngx Mail Rules, the Expensify alternative on Railway (Railway Free Trial)
Google Drive gives searchable PDFs but not IMAP rules, correspondents, Monetary fields, or tax-year saved views. Paperless-ngx replaces that bucket with a receipt archive filed by sender, tag, date, and total. It is free, self-hosted, no per-user SaaS bill or export anxiety.
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Paperless-ngx Mail Rules on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Railway vs Other Hosting Providers and VPS for Paperless-ngx Mail Rules self hosting
| Provider | What you manage | Paperless-ngx notes |
|---|---|---|
| DigitalOcean | Droplet or managed Postgres, Docker, backups, OS updates | You own the stack and mail polling schedule |
| AWS | ECS, RDS, IAM, networking, CloudWatch | Overkill for a personal receipt archive |
| Hetzner | VPS, Docker, firewall, volume backups | Cheap, but manual setup and no one-click mail rules deployment |
Common Use Cases for hosted Paperless-ngx Mail Rules
- Auto-file e-mailed invoices from utilities, SaaS tools, insurance, and suppliers with IMAP rules matching sender or subject.
- Store photographed paper receipts for tax season, then bulk download a saved view as a zip of originals or archived PDFs.
- Track warranty periods with a Warranty Until Date custom field and a scheduled workflow reminder.
Dependencies for Paperless-ngx Mail Rules Docker hosted on Railway
This is not a single container. The template deploys Paperless-ngx, Postgres, and Redis. Mail rules depend on Paperless reaching your IMAP server over port 993 or 143, and on Redis being healthy because Celery handles OCR and mail polling. Mail consumption runs inside the Paperless container, not a separate worker service.
Deployment Dependencies for Managed Paperless-ngx Mail Rules Service (Receipt Management)
- Paperless-ngx 3.3.0 from ghcr.io/paperless-ngx/paperless-ngx:3.3.0, port 8000, volume /usr/src/paperless/data.
- Postgres for document metadata, tags, custom fields, and search index.
- Redis as Celery broker for OCR jobs and scheduled mail polling.
- Railway variables for PAPERLESS_SECRET_KEY, admin user/password/mail, public HTTPS URL, DB connection, Redis URL, OCR language, time zone.
Implementation Details for Paperless-ngx Mail Rules (Using Paperless-ngx official docker image)
Add an IMAP mail account under Settings, Mail. Enter server, port, SSL, username, password. Gmail and Outlook need an app password. Create mail rules that match folder, sender, subject, body, attachment filename, and max age. Choose attachments only in this template; whole message as .eml needs Tika and Gotenberg. After consuming, a rule can mark read, move, flag, delete, or add an IMAP tag.
How does Paperless-ngx Mail Rules compare against other receipt and document management tools
Paperless-ngx vs Expensify
- Receipt capture: Expensify is closed SaaS with reimbursement flows; Paperless-ngx is self-hosted GPL-3.0 with no per-user fee.
- Mail ingestion: Both pull e-mailed receipts, but Paperless rules match folder, sender, subject, body, or attachment filename and assign tags, types, correspondents.
Paperless-ngx vs Google Drive
- Filing model: Drive is generic storage with OCR search; Paperless adds correspondents, types, tags, custom fields, mail rules, workflows built for receipts.
- Mail rules: Drive has no IMAP rule engine; Paperless can watch an inbox folder and consume attachments automatically.
- Metadata: Paperless Monetary, Date, Select fields store totals, invoice numbers, payment methods; Drive cannot.
Paperless-ngx vs Docspell
- Automation style: Docspell is AGPL-3.0, Scala, automation-oriented; Paperless-ngx is Python/Django with larger community and visual mail rule UI.
- Mail rules: Both support IMAP ingestion, but Paperless rules expose folder, sender, subject, body, attachment filename, max age, post-consume actions.
Paperless-ngx vs Evernote
- Purpose: Evernote Personal is about $14.99/mo, a note app with OCR search, not a document management system.
- Mail rules: Paperless matches specific senders or subjects and files attachments; Evernote can receive email into notebooks with weaker conditions.
- Custom fields: Paperless supports Monetary, Date, Select, Document Link; Evernote lacks document-level metadata.
How to use Paperless-ngx Mail Rules (the OSS receipt and invoice archive)?
- Set PAPERLESS_DATE_ORDER=MDY on Railway if your US receipts use MM/DD/YYYY, otherwise dates land in the wrong month. Set PAPERLESS_TIME_ZONE to your local zone for scheduled workflows.
The habit that makes this work: photograph the paper receipt the day you get it, upload through the mobile app or web UI, and let mail rules handle every e-mailed invoice from then on.
How to self host Paperless-ngx Mail Rules on other VPS Services (Paperless-ngx self hosting guide)
For a plain VPS, the official docs recommend Docker Compose. Mail rules remain UI configuration; no extra mail-specific environment variables needed for basic IMAP polling.
Clone the Repository
git clone https://github.com/paperless-ngx/paperless-ngx.git
cd paperless-ngx
Install Dependencies
Install Docker and the Docker Compose plugin. You don't need Python dependencies on the host; the official image bundles Tesseract, OCRmyPDF, and Django.
docker compose version
Configure Environment Variables
Copy docker-compose.env to .env and set PAPERLESS_SECRET_KEY, PAPERLESS_URL, PAPERLESS_TIME_ZONE, PAPERLESS_OCR_LANGUAGE=eng, PAPERLESS_DATE_ORDER=MDY for US dates, and Postgres/Redis connection variables. Mail accounts and rules are created later in the web UI.
Start the Paperless-ngx Mail Rules Application
docker compose up -d
Create an admin user with:
docker compose run --rm webserver createsuperuser
Open port 8000, add a volume for /usr/src/paperless/data, back it up. Mail polling starts every 10 minutes.
Official Pricing of Paperless-ngx Mail Rules (Paperless-ngx pricing)
Paperless-ngx is free and GPL-3.0. No official paid cloud, no per-seat or per-document fee. You pay only for hosting. On Railway, a small personal archive typically costs about $5 to $15 per month depending on service sizing and volume storage. Optional Paperless AI may add LLM API costs.
Paperless-ngx Mail Rules cloud vs self hosted comparison (Pricing, features, costs, and more)
Monthly cost of self hosting Paperless-ngx Mail Rules on Railway
Expect about $5 to $15 per month for a small personal receipt archive, plus volume storage that grows with documents. Railway offers a $5 trial. No license cost. Adding Tika and Gotenberg for .eml mail body consumption would add services and cost; most users stay with attachment-only rules.
System Requirements for Hosting Paperless-ngx Mail Rules on a VPS
2 GB RAM is a comfortable minimum for a single user; more helps with large OCR batches. CPU speed matters because Tesseract OCR is slow on weak CPUs; a Raspberry Pi works but feels sluggish. Storage must hold originals plus generated PDF/A archive copies, roughly double the raw receipt volume. Postgres and Redis have modest needs.
Frequently Asked Questions (FAQs)
Does Paperless-ngx read receipt totals automatically?
No. OCR makes text searchable, but Paperless does not extract totals or line items on its own. Fill Monetary custom fields like Total by hand, or enable optional Paperless AI with an LLM backend for suggestions.
What about faded thermal receipts?
Photograph them early in good light. OCR quality depends on image quality. Default OCR language is eng; other languages need PAPERLESS_OCR_LANGUAGE set, for example eng+deu.
Why are my US receipt dates wrong?
Paperless guesses document dates from content using PAPERLESS_DATE_ORDER, default DMY. Set PAPERLESS_DATE_ORDER=MDY as a Railway variable for MM/DD/YYYY receipts.
How do I get e-mailed invoices into Paperless automatically?
Add an IMAP account in Settings, Mail, then create a mail rule that matches sender, subject, or attachment filename. The rule can assign tags, correspondent, document type, then mark read, move, flag, or delete. Polling every 10 minutes by default.
How do I find all receipts for a tax year?
Create a saved view filtered on created date range and tag Receipts. Add custom field columns like Total and Date Paid, then bulk select documents to download a zip of originals or archived PDFs.
Can my accountant see the archive?
Yes. Create a second user or group and share specific documents, or send share links. Only document owners can create share links. Paperless-ngx v3 also adds share link bundles.
Template Content
paperless-ngx
ghcr.io/paperless-ngx/paperless-ngx:3.3.0Redis
redis:8.2