📧 Lightweight IMAP email backup tool with resume support.
轻量级 IMAP 邮件备份工具,支持断点续传,将邮件安全存储到本地 SQLite 数据库。
- ✅ Full IMAP Sync - 同步所有文件夹,支持断点续传
- ✅ SQLite Storage - 结构化存储,支持全文搜索
- ✅ Attachment Extraction - 自动提取并保存附件
- ✅ Privacy First - 所有数据本地存储,无云端依赖
- ✅ Resume Support - 中断后自动从断点继续
# Clone
git clone https://github.com/wyyxdgm/mailarchiver.git
cd mailarchiver
# Install
npm install
# Configure
cp config.example.json config.json
# Edit config.json with your IMAP credentials
# Sync inbox
npm run sync:inbox
# Sync all folders
npm run sync:all复制 config.example.json 为 config.json,填入邮箱信息:
{
"account": "your@email.com",
"password": "your_app_password_or_token",
"host": "imap.example.com",
"port": 993,
"tls": true
}
⚠️ 注意: 建议使用应用专用密码,而非登录密码。
# 列出所有文件夹
npm run list
# 同步收件箱
npm run sync:inbox
# 同步指定文件夹
npm run sync -- --folder "Sent"
# 同步所有文件夹
npm run sync:all邮件存储在 data/mail.db SQLite 数据库:
| 表名 | 说明 |
|---|---|
folders |
邮箱文件夹列表 |
emails |
邮件元数据(主题、发件人、日期、正文等) |
attachments |
附件信息 |
sync_state |
同步状态(断点续传) |
附件文件存储在 data/attachments/{uid}/ 目录。
- 🔒 所有邮件存储在本地 SQLite 数据库
- 🔒
config.json已加入.gitignore,密码不会被提交 - 🔒 无第三方服务,无数据上传
- imapflow - IMAP 客户端
- mailparser - 邮件解析
- better-sqlite3 - SQLite 数据库
MIT