622 words
3 minutes
From Inbox to Archive

It’s evening after a long day of work. A new email arrives with a PDF attachment — one of those documents you want to keep: save it somewhere safe and make sure it ends up in backups.

I used to do this manually: download the attachment, move it to the right folder on my NAS and then forget about it until I need it again.

Now that same email gets a blue tag in my mail client and the attachment is already filed away — on my NAS and backed up. Sorcery? Not quite. Just open-source.

Automate regular tasks#

I like automating repetitive tasks. For example: my desk power strip switches off automatically once the power draw stays below a threshold for a while. And the TV power is cut when two specific phones leave the Wi‑Fi — a simple “nobody’s home (or awake)” signal.

NOTE

The mentioned examples here are all done with the help of Home Assistant. See also my self hosted services.

This kind of “laziness” is a good excuse to learn new tools — or, in this case, to use an existing tool more effectively. When I received the same type of email again, I finally looked for a way to store those attachments automatically on my NAS (and therefore inside my normal backup routine).

Paperless-ngx once again#

My first instinct was to solve this in the mail client.

But I don’t use the same mail client across all devices and client-side automation tends to be fragile: one device ends up being “the automation machine”, it needs NAS access, it has to be online at the right time and so on.

I also checked what my mail provider could do. That didn’t get me to a clean “file attachments to the NAS” workflow either — especially not one that integrates with my storage and backups.

Then I remembered that Paperless-ngx has an “incoming mail” feature. Since Paperless already lives next to my storage and backups (and is part of my self-hosted stack), this was exactly the missing piece.

After reading the docs and a few guides (e.g. this one in German), it was clear: I’m not the first person with this problem and Paperless-ngx has a solid solution.

Setup#

The setup is well documented and boils down to two concepts:

  1. Defining an e-mail account in paperless-ngx. This is necessary once per e-mail account.
  2. Defining e-mail rules for the e-mail account. This is necessary once per process you want to define.

Step 1 is basically “configure IMAP”: server address, port, credentials. Similar to setting up a mail client on your device.

Step 2 is where the magic happens: you define rules that decide which emails should be processed. I filtered by:

  • mailbox (inbox)
  • sender
  • subject
  • age

Then I configured the rule to consume only the attachment (not the email body). When Paperless-ngx imports the attachment it can automatically set metadata like tags and correspondent.

Finally, I wanted a quick confirmation in my mail client that an email was handled correctly — especially while testing. Paperless-ngx can tag the processed email with a custom IMAP keyword and also ignore emails that already carry that keyword.

In my case, I used the keyword apple:blue, which shows up as a blue tag in Apple Mail.

Apple Mail Blue Flag

And that’s it: emails arrive, attachments get consumed and the originals are marked as processed.

Apple Mail Blue Flag

Final Thoughts#

This was a good reminder to look at the tools I already use before building something new: Paperless-ngx already solved the hard parts.

Manually moving a PDF to a network share isn’t difficult — it’s just the kind of task that’s easy to postpone or forget. Automating it removes that mental overhead and makes the process consistent.

Paperless-ngx keeps on impressing me. And judging from my track record, this won’t be the last time I’ll find another feature that quietly solves an everyday annoyance.

Enjoyed the post? Have questions or feedback? I'd love to hear from you! Feel free to drop me an email at blog@jerey.at.

From Inbox to Archive
https://jerey.at/posts/paperless-ngx-mail/
Author
Anton A. Jerey
Published at
2026-01-26