open-mail-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +313 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15104 -0
- package/dist/index.js.map +1 -0
- package/package.json +92 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mail CLI Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 📧 Mail CLI
|
|
4
|
+
|
|
5
|
+
**A Modern, Feature-Rich Command-Line Email Client**
|
|
6
|
+
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://nodejs.org/)
|
|
9
|
+
[](CONTRIBUTING.md)
|
|
10
|
+
|
|
11
|
+
[English](#english) | [中文](#chinese)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## <a name="english"></a>🌟 Why Mail CLI?
|
|
18
|
+
|
|
19
|
+
In an era dominated by web-based email clients, **Mail CLI** brings the power of email management back to the terminal. Built for developers, system administrators, and power users who value:
|
|
20
|
+
|
|
21
|
+
- **🚀 Speed**: Lightning-fast email operations without browser overhead
|
|
22
|
+
- **🔒 Privacy**: Your emails stay on your machine, encrypted and secure
|
|
23
|
+
- **⚡ Efficiency**: Keyboard-driven workflow with powerful automation
|
|
24
|
+
- **🎯 Focus**: Distraction-free email management in your terminal
|
|
25
|
+
- **🔧 Extensibility**: Built with modern Node.js, easy to customize and extend
|
|
26
|
+
|
|
27
|
+
## ✨ Key Features
|
|
28
|
+
|
|
29
|
+
### 📬 Core Email Operations
|
|
30
|
+
- **Full IMAP/SMTP Support** - Works with Gmail, Outlook, QQ Mail, and any standard email service
|
|
31
|
+
- **Offline-First Architecture** - SQLite-based local storage for instant access
|
|
32
|
+
- **Smart Sync** - Incremental synchronization with conflict resolution
|
|
33
|
+
- **Rich Email Viewing** - HTML rendering, attachment handling, and inline images
|
|
34
|
+
|
|
35
|
+
### 🎨 Advanced Features (P1)
|
|
36
|
+
- **📊 Email Threading** - Automatic conversation grouping and visualization
|
|
37
|
+
- **👥 Contact Management** - Built-in address book with groups and auto-collection
|
|
38
|
+
- **✍️ Email Signatures** - Multiple signatures with smart insertion
|
|
39
|
+
- **🛡️ Spam Detection** - Bayesian filtering with customizable rules
|
|
40
|
+
- **🔍 Advanced Filters** - Rule-based email automation and organization
|
|
41
|
+
- **⚡ Quick Filters** - One-click filtering for common scenarios
|
|
42
|
+
- **💾 Saved Searches** - Bookmark complex search queries
|
|
43
|
+
- **🔄 Background Sync** - Daemon mode for automatic email synchronization
|
|
44
|
+
|
|
45
|
+
### 🚀 Power User Features (P2)
|
|
46
|
+
- **📝 Email Templates** - Variable substitution with `{{placeholders}}`
|
|
47
|
+
- **🔔 Smart Notifications** - Desktop alerts with intelligent filtering
|
|
48
|
+
- **📦 Import/Export** - Full support for EML and MBOX formats
|
|
49
|
+
- **🔐 Multi-Account** - Manage multiple email accounts seamlessly
|
|
50
|
+
|
|
51
|
+
## 🎯 Perfect For
|
|
52
|
+
|
|
53
|
+
- **Developers** who live in the terminal
|
|
54
|
+
- **System Administrators** managing email automation
|
|
55
|
+
- **Privacy-Conscious Users** who want local email storage
|
|
56
|
+
- **Power Users** seeking keyboard-driven workflows
|
|
57
|
+
- **DevOps Engineers** integrating email into scripts and pipelines
|
|
58
|
+
|
|
59
|
+
## 🚀 Quick Start
|
|
60
|
+
|
|
61
|
+
### Installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Clone the repository
|
|
65
|
+
git clone https://github.com/eric8810/mail-cli.git
|
|
66
|
+
cd mail-cli
|
|
67
|
+
|
|
68
|
+
# Install dependencies
|
|
69
|
+
npm install
|
|
70
|
+
|
|
71
|
+
# Link globally (optional)
|
|
72
|
+
npm link
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### First-Time Setup
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Interactive configuration wizard
|
|
79
|
+
mail-client config
|
|
80
|
+
|
|
81
|
+
# Or configure manually
|
|
82
|
+
mail-client config --set imap.host=imap.gmail.com
|
|
83
|
+
mail-client config --set imap.port=993
|
|
84
|
+
mail-client config --set smtp.host=smtp.gmail.com
|
|
85
|
+
mail-client config --set smtp.port=465
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Basic Usage
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Sync your inbox
|
|
92
|
+
mail-client sync
|
|
93
|
+
|
|
94
|
+
# List emails
|
|
95
|
+
mail-client list
|
|
96
|
+
|
|
97
|
+
# Read an email
|
|
98
|
+
mail-client read 1
|
|
99
|
+
|
|
100
|
+
# Send an email
|
|
101
|
+
mail-client send --to user@example.com --subject "Hello" --body "World"
|
|
102
|
+
|
|
103
|
+
# Search emails
|
|
104
|
+
mail-client search "meeting"
|
|
105
|
+
|
|
106
|
+
# Start background sync daemon
|
|
107
|
+
mail-client sync daemon start
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 📚 Documentation
|
|
111
|
+
|
|
112
|
+
- [📖 User Guide](docs/用户使用手册.md) - Comprehensive usage guide
|
|
113
|
+
- [🏗️ Architecture](docs/architecture.md) - Technical architecture overview
|
|
114
|
+
- [🔧 Configuration](docs/requirements.md) - Detailed configuration options
|
|
115
|
+
- [🎨 Features](docs/功能清单.md) - Complete feature list
|
|
116
|
+
- [🧪 Testing](docs/P2功能测试报告.md) - Test reports and quality assurance
|
|
117
|
+
|
|
118
|
+
## 🛠️ Technology Stack
|
|
119
|
+
|
|
120
|
+
- **Runtime**: Node.js 18+ (LTS)
|
|
121
|
+
- **Database**: SQLite3 with better-sqlite3
|
|
122
|
+
- **Email Protocols**: IMAP (node-imap), SMTP (nodemailer)
|
|
123
|
+
- **CLI Framework**: Commander.js, Inquirer.js
|
|
124
|
+
- **Email Parsing**: mailparser
|
|
125
|
+
- **UI/UX**: Chalk, Ora, CLI-Table3
|
|
126
|
+
|
|
127
|
+
## 📊 Project Stats
|
|
128
|
+
|
|
129
|
+
- **100+ Files** - Well-organized modular architecture
|
|
130
|
+
- **32,000+ Lines** - Production-ready codebase
|
|
131
|
+
- **16 CLI Commands** - Comprehensive email management
|
|
132
|
+
- **41 Test Cases** - 100% pass rate
|
|
133
|
+
- **11 Modules** - Clean separation of concerns
|
|
134
|
+
|
|
135
|
+
## 🎨 Feature Highlights
|
|
136
|
+
|
|
137
|
+
### Email Templates with Variables
|
|
138
|
+
```bash
|
|
139
|
+
# Create a template
|
|
140
|
+
mail-client template create --name "Meeting" \
|
|
141
|
+
--subject "Meeting on {{date}}" \
|
|
142
|
+
--text "Hi {{name}}, let's meet at {{time}}"
|
|
143
|
+
|
|
144
|
+
# Use the template
|
|
145
|
+
mail-client template use 1 --var name=John --var time="2pm"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Smart Notifications
|
|
149
|
+
```bash
|
|
150
|
+
# Enable notifications
|
|
151
|
+
mail-client notify enable
|
|
152
|
+
|
|
153
|
+
# Configure filters
|
|
154
|
+
mail-client notify config --sender boss@company.com --important-only
|
|
155
|
+
|
|
156
|
+
# Test notifications
|
|
157
|
+
mail-client notify test
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Import/Export
|
|
161
|
+
```bash
|
|
162
|
+
# Export folder to MBOX
|
|
163
|
+
mail-client export folder INBOX backup.mbox
|
|
164
|
+
|
|
165
|
+
# Import emails from EML
|
|
166
|
+
mail-client import eml message.eml --folder INBOX
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## 🤝 Contributing
|
|
170
|
+
|
|
171
|
+
We welcome contributions! Whether it's:
|
|
172
|
+
|
|
173
|
+
- 🐛 Bug reports
|
|
174
|
+
- 💡 Feature requests
|
|
175
|
+
- 📝 Documentation improvements
|
|
176
|
+
- 🔧 Code contributions
|
|
177
|
+
|
|
178
|
+
Please read our [Contributing Guide](CONTRIBUTING.md) to get started.
|
|
179
|
+
|
|
180
|
+
## 📜 License
|
|
181
|
+
|
|
182
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
183
|
+
|
|
184
|
+
## 🙏 Acknowledgments
|
|
185
|
+
|
|
186
|
+
Built with ❤️ using these amazing open-source projects:
|
|
187
|
+
- [node-imap](https://github.com/mscdex/node-imap) - IMAP client
|
|
188
|
+
- [nodemailer](https://nodemailer.com/) - SMTP client
|
|
189
|
+
- [better-sqlite3](https://github.com/WiseLibs/better-sqlite3) - SQLite wrapper
|
|
190
|
+
- [Commander.js](https://github.com/tj/commander.js) - CLI framework
|
|
191
|
+
- [mailparser](https://github.com/nodemailer/mailparser) - Email parser
|
|
192
|
+
|
|
193
|
+
## 🌟 Star History
|
|
194
|
+
|
|
195
|
+
If you find this project useful, please consider giving it a ⭐!
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## <a name="chinese"></a>🌟 为什么选择 Mail CLI?
|
|
200
|
+
|
|
201
|
+
在网页邮件客户端主导的时代,**Mail CLI** 将邮件管理的强大功能带回终端。专为开发者、系统管理员和高级用户打造:
|
|
202
|
+
|
|
203
|
+
- **🚀 速度**: 无浏览器开销的闪电般快速邮件操作
|
|
204
|
+
- **🔒 隐私**: 邮件保存在本地,加密且安全
|
|
205
|
+
- **⚡ 效率**: 键盘驱动的工作流,强大的自动化能力
|
|
206
|
+
- **🎯 专注**: 终端中无干扰的邮件管理
|
|
207
|
+
- **🔧 可扩展**: 基于现代 Node.js 构建,易于定制和扩展
|
|
208
|
+
|
|
209
|
+
## ✨ 核心特性
|
|
210
|
+
|
|
211
|
+
### 📬 基础邮件功能
|
|
212
|
+
- **完整 IMAP/SMTP 支持** - 兼容 Gmail、Outlook、QQ邮箱等所有标准邮件服务
|
|
213
|
+
- **离线优先架构** - 基于 SQLite 的本地存储,即时访问
|
|
214
|
+
- **智能同步** - 增量同步,冲突解决
|
|
215
|
+
- **丰富的邮件查看** - HTML 渲染、附件处理、内联图片
|
|
216
|
+
|
|
217
|
+
### 🎨 高级功能 (P1)
|
|
218
|
+
- **📊 邮件会话** - 自动对话分组和可视化
|
|
219
|
+
- **👥 联系人管理** - 内置通讯录,支持分组和自动收集
|
|
220
|
+
- **✍️ 邮件签名** - 多签名支持,智能插入
|
|
221
|
+
- **🛡️ 垃圾邮件检测** - 贝叶斯过滤,可自定义规则
|
|
222
|
+
- **🔍 高级过滤器** - 基于规则的邮件自动化和组织
|
|
223
|
+
- **⚡ 快速过滤** - 常见场景的一键过滤
|
|
224
|
+
- **💾 保存的搜索** - 收藏复杂搜索查询
|
|
225
|
+
- **🔄 后台同步** - 守护进程模式,自动邮件同步
|
|
226
|
+
|
|
227
|
+
### 🚀 专业功能 (P2)
|
|
228
|
+
- **📝 邮件模板** - 支持 `{{占位符}}` 变量替换
|
|
229
|
+
- **🔔 智能通知** - 桌面提醒,智能过滤
|
|
230
|
+
- **📦 导入/导出** - 完整支持 EML 和 MBOX 格式
|
|
231
|
+
- **🔐 多账户** - 无缝管理多个邮箱账户
|
|
232
|
+
|
|
233
|
+
## 🚀 快速开始
|
|
234
|
+
|
|
235
|
+
### 安装
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# 克隆仓库
|
|
239
|
+
git clone https://github.com/eric8810/mail-cli.git
|
|
240
|
+
cd mail-cli
|
|
241
|
+
|
|
242
|
+
# 安装依赖
|
|
243
|
+
npm install
|
|
244
|
+
|
|
245
|
+
# 全局链接(可选)
|
|
246
|
+
npm link
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### 首次配置
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
# 交互式配置向导
|
|
253
|
+
mail-client config
|
|
254
|
+
|
|
255
|
+
# 或手动配置
|
|
256
|
+
mail-client config --set imap.host=imap.gmail.com
|
|
257
|
+
mail-client config --set imap.port=993
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### 基本使用
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# 同步收件箱
|
|
264
|
+
mail-client sync
|
|
265
|
+
|
|
266
|
+
# 列出邮件
|
|
267
|
+
mail-client list
|
|
268
|
+
|
|
269
|
+
# 阅读邮件
|
|
270
|
+
mail-client read 1
|
|
271
|
+
|
|
272
|
+
# 发送邮件
|
|
273
|
+
mail-client send --to user@example.com --subject "你好" --body "世界"
|
|
274
|
+
|
|
275
|
+
# 搜索邮件
|
|
276
|
+
mail-client search "会议"
|
|
277
|
+
|
|
278
|
+
# 启动后台同步守护进程
|
|
279
|
+
mail-client sync daemon start
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## 📊 项目统计
|
|
283
|
+
|
|
284
|
+
- **100+ 文件** - 组织良好的模块化架构
|
|
285
|
+
- **32,000+ 行代码** - 生产就绪的代码库
|
|
286
|
+
- **16 个 CLI 命令** - 全面的邮件管理
|
|
287
|
+
- **41 个测试用例** - 100% 通过率
|
|
288
|
+
- **11 个模块** - 清晰的关注点分离
|
|
289
|
+
|
|
290
|
+
## 🤝 贡献
|
|
291
|
+
|
|
292
|
+
我们欢迎各种形式的贡献:
|
|
293
|
+
|
|
294
|
+
- 🐛 Bug 报告
|
|
295
|
+
- 💡 功能建议
|
|
296
|
+
- 📝 文档改进
|
|
297
|
+
- 🔧 代码贡献
|
|
298
|
+
|
|
299
|
+
请阅读我们的[贡献指南](CONTRIBUTING.md)开始参与。
|
|
300
|
+
|
|
301
|
+
## 📜 许可证
|
|
302
|
+
|
|
303
|
+
本项目采用 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件。
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
<div align="center">
|
|
308
|
+
|
|
309
|
+
**Made with ❤️ by developers, for developers**
|
|
310
|
+
|
|
311
|
+
[⬆ Back to Top](#-mail-cli)
|
|
312
|
+
|
|
313
|
+
</div>
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|