一个小型 Python 脚本,监控邮箱中来自授权发件人的附件,并通过 CUPS 打印,专为家庭使用设计,避免依赖厂商云打印服务。

Stars

121

7 天增长

暂无数据

Fork 数

5

开放 Issue

0

开源协议

MIT

最近更新

2026-07-06

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

简单、自托管的解决方案,仅使用 Python 标准库和少量外部依赖,采用故障关闭的允许列表和确认邮件,自 2026 年春季以来稳定运行。

适合谁使用

  • 自托管和家庭实验室爱好者
  • 希望方便打印而无需厂商云服务的家庭
  • 注重隐私、避免使用云打印服务的用户
  • 具备基本 Linux/Docker 技能的个人

典型使用场景

  • 打印家人通过邮件发送的许可单和作业
  • 打印转发的邮件(渲染邮件正文)
  • 通过无头 LibreOffice 转换并打印 Office 文档(Word、电子表格)
  • 为家人提供专用打印地址并控制访问权限

项目优势

  • 仅使用 Python 标准库和系统包(cups-client、libreoffice-nogui)
  • 故障关闭的允许列表;空列表阻止所有打印
  • 成功打印发送确认邮件,陌生人静默拒绝
  • 无数据库;通过将已处理邮件移出监控文件夹实现去重

使用前须知

  • From 标头可被伪造;可选的 SPF/DKIM 检查并非完全可靠
  • LibreOffice 转换复杂文档时可能产生丑陋输出
  • 至少一次投递:若进程在打印后但在移动邮件前崩溃,可能导致重复打印

README 快速开始

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

项目描述

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

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

lopopolo
精选
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 与机器学习AI 智能体
2,390
slvDev
精选
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 与机器学习大语言模型
1,960
littledivy
精选
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 与机器学习
1,482