A small Python script that watches a mailbox for email attachments from an allowlist of senders and prints them using CUPS, designed for family use to avoid vendor cloud print services.

Stars

121

7-day growth

No data

Forks

5

Open issues

0

License

MIT

Last updated

2026-07-06

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

Simple, self-hosted solution that uses stdlib Python and minimal external dependencies, with a fail-closed allowlist and confirmation emails, running reliably in production since spring 2026.

Who it is for

  • Self-hosters and homelab enthusiasts
  • Families wanting convenient printer access without vendor cloud services
  • Privacy-conscious users avoiding cloud print services
  • Individuals with basic Linux/Docker skills

Use cases

  • Print permission slips and homework emailed by family members
  • Print forwarded emails by rendering the email body
  • Convert and print Office documents (Word, spreadsheets) via headless LibreOffice
  • Provide a dedicated print address for family members with access control

Strengths

  • Uses only Python stdlib and system packages (cups-client, libreoffice-nogui)
  • Fail-closed allowlist; empty list blocks all prints
  • Sends confirmation emails for successful prints and silent rejection for strangers
  • No database; dedup handled by moving processed messages out of watch folder

Considerations

  • From header can be spoofed; optional SPF/DKIM check is not foolproof
  • LibreOffice conversion may produce ugly output for complex documents
  • At-least-once delivery: if process crashes after printing but before moving message, a duplicate print could occur

README quick start

email-to-print

My family emails a PDF or a photo to a print address on our domain. A small Python script watches that mailbox, checks the sender against a list of four people, converts the file if it needs converting, and hands it to CUPS. The printer is a boring HP laser from 2017. That's the whole system.

A bunch of people asked for a writeup after I posted about this, so this README is the writeup. Fair warning that none of it is clever. It's mostly plumbing, and half of it is a mail filter.

The expanded version — full architecture walkthrough plus answers to every question from the Reddit thread (duplex control, dedup, the watched-folder and QR-card variants) — lives here: https://benchnotes.net/blog/email-to-print-self-hosted/

The reason it exists is dumber than the system. My wife would airdrop me a permission slip, I'd open it on my desktop, print it, and wonder why I was involved at all. The printer vendors solve this with their cloud print services, but I didn't want school forms bouncing through someone else's servers, and those services have a habit of getting discontinued.

This is the actual code running in my house, with my personal values stripped out. It's been printing homework and permission slips since spring 2026.

The pieces

phone/laptop
     |  email with attachment
     v
your mail provider  ->  (ProtonMail Bridge, if Proton)  ->  IMAP folder
                                                              |
                                                    print-poller (this repo)
                                                              |
                                        allowlist check -> convert -> lp
                                                              |
                                                        CUPS -> printer

The mailbox is a Proton account I already had. Proton doesn't do plain IMAP, so ProtonMail Bridge runs in Docker and exposes the account as IMAP on localhost. The bridge uses a self-signed cert, which is why the example env sets TLS_VERIFY=false; that setting is for localhost only, and verification stays on for anything else. If you use Gmail or anything normal you can skip the bridge entirely and point straight at your provider. The compose pins the bridge image to the exact digest running in my house; it's a community image, so read the comment above it bef

Description

Email a PDF to your printer. Self-hosted, no vendor cloud.

Related repositories

Similar projects matched by category, topics, and programming language.

lopopolo
Featured
lopopolo GitHub avatar

harness-engineering

Harness Engineering is a methodology for improving coding agent outputs by carefully crafting the environment around them—providing curated context, tools, and executable constraints that encode an organization’s nonfunctional requirements and cumulative lessons.

AI & Machine LearningAI Agents
2,390
slvDev
Featured
slvDev GitHub avatar

esp32-ai

A 28.9 million parameter language model runs on an $8 ESP32-S3 microcontroller entirely on-device, generating simple stories at about 9.5 tokens per second.

AI & Machine LearningLarge Language Models
1,960
littledivy
Featured
littledivy GitHub avatar

mimic

mimic captures traffic from any iOS or web app and automatically generates a Python client library that lets you call the app's API like a regular library.

AI & Machine Learning
1,482