open-mail-cli 1.0.0 → 1.0.1

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <div align="center">
2
2
 
3
- # 📧 Mail CLI
3
+ # 📧 Open Mail CLI
4
4
 
5
5
  **A Modern, Feature-Rich Command-Line Email Client**
6
6
 
@@ -14,9 +14,9 @@
14
14
 
15
15
  ---
16
16
 
17
- ## <a name="english"></a>🌟 Why Mail CLI?
17
+ ## <a name="english"></a>🌟 Why Open Mail CLI?
18
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:
19
+ In an era dominated by web-based email clients, **Open Mail CLI** brings the power of email management back to the terminal. Built for developers, system administrators, and power users who value:
20
20
 
21
21
  - **🚀 Speed**: Lightning-fast email operations without browser overhead
22
22
  - **🔒 Privacy**: Your emails stay on your machine, encrypted and secure
@@ -62,8 +62,8 @@ In an era dominated by web-based email clients, **Mail CLI** brings the power of
62
62
 
63
63
  ```bash
64
64
  # Clone the repository
65
- git clone https://github.com/eric8810/mail-cli.git
66
- cd mail-cli
65
+ git clone https://github.com/eric8810/open-mail-cli.git
66
+ cd open-mail-cli
67
67
 
68
68
  # Install dependencies
69
69
  npm install
@@ -76,35 +76,35 @@ npm link
76
76
 
77
77
  ```bash
78
78
  # Interactive configuration wizard
79
- mail-client config
79
+ mail-cli config
80
80
 
81
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
82
+ mail-cli config --set imap.host=imap.gmail.com
83
+ mail-cli config --set imap.port=993
84
+ mail-cli config --set smtp.host=smtp.gmail.com
85
+ mail-cli config --set smtp.port=465
86
86
  ```
87
87
 
88
88
  ### Basic Usage
89
89
 
90
90
  ```bash
91
91
  # Sync your inbox
92
- mail-client sync
92
+ mail-cli sync
93
93
 
94
94
  # List emails
95
- mail-client list
95
+ mail-cli list
96
96
 
97
97
  # Read an email
98
- mail-client read 1
98
+ mail-cli read 1
99
99
 
100
100
  # Send an email
101
- mail-client send --to user@example.com --subject "Hello" --body "World"
101
+ mail-cli send --to user@example.com --subject "Hello" --body "World"
102
102
 
103
103
  # Search emails
104
- mail-client search "meeting"
104
+ mail-cli search "meeting"
105
105
 
106
106
  # Start background sync daemon
107
- mail-client sync daemon start
107
+ mail-cli sync daemon start
108
108
  ```
109
109
 
110
110
  ## 📚 Documentation
@@ -137,33 +137,33 @@ mail-client sync daemon start
137
137
  ### Email Templates with Variables
138
138
  ```bash
139
139
  # Create a template
140
- mail-client template create --name "Meeting" \
140
+ mail-cli template create --name "Meeting" \
141
141
  --subject "Meeting on {{date}}" \
142
142
  --text "Hi {{name}}, let's meet at {{time}}"
143
143
 
144
144
  # Use the template
145
- mail-client template use 1 --var name=John --var time="2pm"
145
+ mail-cli template use 1 --var name=John --var time="2pm"
146
146
  ```
147
147
 
148
148
  ### Smart Notifications
149
149
  ```bash
150
150
  # Enable notifications
151
- mail-client notify enable
151
+ mail-cli notify enable
152
152
 
153
153
  # Configure filters
154
- mail-client notify config --sender boss@company.com --important-only
154
+ mail-cli notify config --sender boss@company.com --important-only
155
155
 
156
156
  # Test notifications
157
- mail-client notify test
157
+ mail-cli notify test
158
158
  ```
159
159
 
160
160
  ### Import/Export
161
161
  ```bash
162
162
  # Export folder to MBOX
163
- mail-client export folder INBOX backup.mbox
163
+ mail-cli export folder INBOX backup.mbox
164
164
 
165
165
  # Import emails from EML
166
- mail-client import eml message.eml --folder INBOX
166
+ mail-cli import eml message.eml --folder INBOX
167
167
  ```
168
168
 
169
169
  ## 🤝 Contributing
@@ -196,9 +196,9 @@ If you find this project useful, please consider giving it a ⭐!
196
196
 
197
197
  ---
198
198
 
199
- ## <a name="chinese"></a>🌟 为什么选择 Mail CLI?
199
+ ## <a name="chinese"></a>🌟 为什么选择 Open Mail CLI?
200
200
 
201
- 在网页邮件客户端主导的时代,**Mail CLI** 将邮件管理的强大功能带回终端。专为开发者、系统管理员和高级用户打造:
201
+ 在网页邮件客户端主导的时代,**Open Mail CLI** 将邮件管理的强大功能带回终端。专为开发者、系统管理员和高级用户打造:
202
202
 
203
203
  - **🚀 速度**: 无浏览器开销的闪电般快速邮件操作
204
204
  - **🔒 隐私**: 邮件保存在本地,加密且安全
@@ -236,8 +236,8 @@ If you find this project useful, please consider giving it a ⭐!
236
236
 
237
237
  ```bash
238
238
  # 克隆仓库
239
- git clone https://github.com/eric8810/mail-cli.git
240
- cd mail-cli
239
+ git clone https://github.com/eric8810/open-mail-cli.git
240
+ cd open-mail-cli
241
241
 
242
242
  # 安装依赖
243
243
  npm install
@@ -250,33 +250,33 @@ npm link
250
250
 
251
251
  ```bash
252
252
  # 交互式配置向导
253
- mail-client config
253
+ mail-cli config
254
254
 
255
255
  # 或手动配置
256
- mail-client config --set imap.host=imap.gmail.com
257
- mail-client config --set imap.port=993
256
+ mail-cli config --set imap.host=imap.gmail.com
257
+ mail-cli config --set imap.port=993
258
258
  ```
259
259
 
260
260
  ### 基本使用
261
261
 
262
262
  ```bash
263
263
  # 同步收件箱
264
- mail-client sync
264
+ mail-cli sync
265
265
 
266
266
  # 列出邮件
267
- mail-client list
267
+ mail-cli list
268
268
 
269
269
  # 阅读邮件
270
- mail-client read 1
270
+ mail-cli read 1
271
271
 
272
272
  # 发送邮件
273
- mail-client send --to user@example.com --subject "你好" --body "世界"
273
+ mail-cli send --to user@example.com --subject "你好" --body "世界"
274
274
 
275
275
  # 搜索邮件
276
- mail-client search "会议"
276
+ mail-cli search "会议"
277
277
 
278
278
  # 启动后台同步守护进程
279
- mail-client sync daemon start
279
+ mail-cli sync daemon start
280
280
  ```
281
281
 
282
282
  ## 📊 项目统计
@@ -308,6 +308,6 @@ mail-client sync daemon start
308
308
 
309
309
  **Made with ❤️ by developers, for developers**
310
310
 
311
- [⬆ Back to Top](#-mail-cli)
311
+ [⬆ Back to Top](#-open-mail-cli)
312
312
 
313
313
  </div>
package/dist/index.js CHANGED
@@ -252,19 +252,19 @@ function getConfigDir() {
252
252
  if (process.platform === "win32") {
253
253
  return import_node_path.default.join(
254
254
  process.env.APPDATA ?? import_node_path.default.join(import_node_os.default.homedir(), "AppData", "Roaming"),
255
- "mail-client"
255
+ "open-mail-client"
256
256
  );
257
257
  }
258
- return import_node_path.default.join(import_node_os.default.homedir(), ".config", "mail-client");
258
+ return import_node_path.default.join(import_node_os.default.homedir(), ".config", "open-mail-client");
259
259
  }
260
260
  function getDataDir() {
261
261
  if (process.platform === "win32") {
262
262
  return import_node_path.default.join(
263
263
  process.env.LOCALAPPDATA ?? import_node_path.default.join(import_node_os.default.homedir(), "AppData", "Local"),
264
- "mail-client"
264
+ "open-mail-client"
265
265
  );
266
266
  }
267
- return import_node_path.default.join(import_node_os.default.homedir(), ".local", "share", "mail-client");
267
+ return import_node_path.default.join(import_node_os.default.homedir(), ".local", "share", "open-mail-client");
268
268
  }
269
269
  function formatDate(date) {
270
270
  if (!date) {
@@ -309,7 +309,7 @@ var init_logger = __esm({
309
309
  */
310
310
  constructor(logDir = null) {
311
311
  this.logDir = logDir ?? import_node_path2.default.join(process.cwd(), "data", "logs");
312
- this.logFile = import_node_path2.default.join(this.logDir, "mail-client.log");
312
+ this.logFile = import_node_path2.default.join(this.logDir, "open-mail-client.log");
313
313
  this.levels = {
314
314
  ERROR: 0,
315
315
  WARN: 1,
@@ -8341,7 +8341,7 @@ Total: ${drafts.length} drafts`));
8341
8341
  const draftId = options.id || options._[1];
8342
8342
  if (!draftId) {
8343
8343
  console.error(import_chalk7.default.red("Draft ID is required"));
8344
- console.log(import_chalk7.default.gray("Usage: mail-client draft edit <draft-id>"));
8344
+ console.log(import_chalk7.default.gray("Usage: mail-cli draft edit <draft-id>"));
8345
8345
  process.exit(1);
8346
8346
  }
8347
8347
  const spinner = (0, import_ora2.default)("Loading draft...").start();
@@ -8408,7 +8408,7 @@ Total: ${drafts.length} drafts`));
8408
8408
  const draftId = options.id || options._[1];
8409
8409
  if (!draftId) {
8410
8410
  console.error(import_chalk7.default.red("Draft ID is required"));
8411
- console.log(import_chalk7.default.gray("Usage: mail-client draft delete <draft-id>"));
8411
+ console.log(import_chalk7.default.gray("Usage: mail-cli draft delete <draft-id>"));
8412
8412
  process.exit(1);
8413
8413
  }
8414
8414
  const draft = email_default.findById(draftId);
@@ -8445,7 +8445,7 @@ Total: ${drafts.length} drafts`));
8445
8445
  const draftId = options.id || options._[1];
8446
8446
  if (!draftId) {
8447
8447
  console.error(import_chalk7.default.red("Draft ID is required"));
8448
- console.log(import_chalk7.default.gray("Usage: mail-client draft send <draft-id>"));
8448
+ console.log(import_chalk7.default.gray("Usage: mail-cli draft send <draft-id>"));
8449
8449
  process.exit(1);
8450
8450
  }
8451
8451
  const draft = email_default.findById(draftId);
@@ -8481,7 +8481,7 @@ Total: ${drafts.length} drafts`));
8481
8481
  const cfg = config_default.load();
8482
8482
  if (!cfg.smtp.host || !cfg.smtp.user || !cfg.smtp.password) {
8483
8483
  spinner.fail("SMTP configuration incomplete");
8484
- console.error(import_chalk7.default.red("Please run: mail-client config"));
8484
+ console.error(import_chalk7.default.red("Please run: mail-cli config"));
8485
8485
  process.exit(1);
8486
8486
  }
8487
8487
  const composer = new composer_default();
@@ -8506,7 +8506,7 @@ Total: ${drafts.length} drafts`));
8506
8506
  const cfg = config_default.load();
8507
8507
  if (!cfg.imap.host || !cfg.imap.user || !cfg.imap.password) {
8508
8508
  spinner.fail("IMAP configuration incomplete");
8509
- console.error(import_chalk7.default.red("Please run: mail-client config"));
8509
+ console.error(import_chalk7.default.red("Please run: mail-cli config"));
8510
8510
  process.exit(1);
8511
8511
  }
8512
8512
  const sync = new sync_default(cfg.imap);
@@ -8948,9 +8948,7 @@ var require_forward = __commonJS({
8948
8948
  const cfg = config_default.load();
8949
8949
  if (!cfg.smtp.host || !cfg.smtp.user || !cfg.smtp.password) {
8950
8950
  console.error(
8951
- import_chalk7.default.red(
8952
- "SMTP configuration incomplete. Please run: mail-client config"
8953
- )
8951
+ import_chalk7.default.red("SMTP configuration incomplete. Please run: mail-cli config")
8954
8952
  );
8955
8953
  process.exit(1);
8956
8954
  }
@@ -11145,7 +11143,7 @@ var require_read = __commonJS({
11145
11143
  try {
11146
11144
  if (!emailId) {
11147
11145
  console.error(import_chalk7.default.red("Error: Email ID is required"));
11148
- console.log("Usage: mail-client read <id>");
11146
+ console.log("Usage: mail-cli read <id>");
11149
11147
  process.exit(1);
11150
11148
  }
11151
11149
  const email = email_default.findById(emailId);
@@ -11219,9 +11217,7 @@ var require_reply = __commonJS({
11219
11217
  const cfg = config_default.load();
11220
11218
  if (!cfg.smtp.host || !cfg.smtp.user || !cfg.smtp.password) {
11221
11219
  console.error(
11222
- import_chalk7.default.red(
11223
- "SMTP configuration incomplete. Please run: mail-client config"
11224
- )
11220
+ import_chalk7.default.red("SMTP configuration incomplete. Please run: mail-cli config")
11225
11221
  );
11226
11222
  process.exit(1);
11227
11223
  }
@@ -11515,7 +11511,7 @@ var require_search = __commonJS({
11515
11511
  const query = buildSearchQuery(keyword, options);
11516
11512
  if (Object.keys(query).length === 0 || Object.keys(query).length === 1 && query.limit) {
11517
11513
  console.error(import_chalk7.default.red("Error: Please provide search criteria"));
11518
- console.log("Usage: mail-client search <keyword> [options]");
11514
+ console.log("Usage: mail-cli search <keyword> [options]");
11519
11515
  console.log();
11520
11516
  console.log("Options:");
11521
11517
  console.log(" --from <email> Search by sender");
@@ -12104,9 +12100,7 @@ var require_send = __commonJS({
12104
12100
  const cfg = config_default.load();
12105
12101
  if (!cfg.smtp.host || !cfg.smtp.user || !cfg.smtp.password) {
12106
12102
  console.error(
12107
- import_chalk7.default.red(
12108
- "SMTP configuration incomplete. Please run: mail-client config"
12109
- )
12103
+ import_chalk7.default.red("SMTP configuration incomplete. Please run: mail-cli config")
12110
12104
  );
12111
12105
  process.exit(1);
12112
12106
  }
@@ -12595,14 +12589,14 @@ Scan complete: ${spamCount} spam emails detected`);
12595
12589
  switch (action) {
12596
12590
  case "mark":
12597
12591
  if (!args[0]) {
12598
- console.error("Usage: mail-client spam mark <email-id>");
12592
+ console.error("Usage: mail-cli spam mark <email-id>");
12599
12593
  return;
12600
12594
  }
12601
12595
  await markAsSpam(parseInt(args[0]));
12602
12596
  break;
12603
12597
  case "unmark":
12604
12598
  if (!args[0]) {
12605
- console.error("Usage: mail-client spam unmark <email-id>");
12599
+ console.error("Usage: mail-cli spam unmark <email-id>");
12606
12600
  return;
12607
12601
  }
12608
12602
  await unmarkAsSpam(parseInt(args[0]));
@@ -12615,14 +12609,14 @@ Scan complete: ${spamCount} spam emails detected`);
12615
12609
  if (blacklistAction === "add") {
12616
12610
  if (!args[1]) {
12617
12611
  console.error(
12618
- "Usage: mail-client spam blacklist add <email> [reason]"
12612
+ "Usage: mail-cli spam blacklist add <email> [reason]"
12619
12613
  );
12620
12614
  return;
12621
12615
  }
12622
12616
  await addToBlacklist(args[1], args.slice(2).join(" "));
12623
12617
  } else if (blacklistAction === "remove") {
12624
12618
  if (!args[1]) {
12625
- console.error("Usage: mail-client spam blacklist remove <email>");
12619
+ console.error("Usage: mail-cli spam blacklist remove <email>");
12626
12620
  return;
12627
12621
  }
12628
12622
  await removeFromBlacklist(args[1]);
@@ -12630,7 +12624,7 @@ Scan complete: ${spamCount} spam emails detected`);
12630
12624
  await listBlacklist();
12631
12625
  } else {
12632
12626
  console.error(
12633
- "Usage: mail-client spam blacklist <add|remove|list> [email]"
12627
+ "Usage: mail-cli spam blacklist <add|remove|list> [email]"
12634
12628
  );
12635
12629
  }
12636
12630
  break;
@@ -12638,13 +12632,13 @@ Scan complete: ${spamCount} spam emails detected`);
12638
12632
  const whitelistAction = args[0];
12639
12633
  if (whitelistAction === "add") {
12640
12634
  if (!args[1]) {
12641
- console.error("Usage: mail-client spam whitelist add <email>");
12635
+ console.error("Usage: mail-cli spam whitelist add <email>");
12642
12636
  return;
12643
12637
  }
12644
12638
  await addToWhitelist(args[1]);
12645
12639
  } else if (whitelistAction === "remove") {
12646
12640
  if (!args[1]) {
12647
- console.error("Usage: mail-client spam whitelist remove <email>");
12641
+ console.error("Usage: mail-cli spam whitelist remove <email>");
12648
12642
  return;
12649
12643
  }
12650
12644
  await removeFromWhitelist(args[1]);
@@ -12652,7 +12646,7 @@ Scan complete: ${spamCount} spam emails detected`);
12652
12646
  await listWhitelist();
12653
12647
  } else {
12654
12648
  console.error(
12655
- "Usage: mail-client spam whitelist <add|remove|list> [email]"
12649
+ "Usage: mail-cli spam whitelist <add|remove|list> [email]"
12656
12650
  );
12657
12651
  }
12658
12652
  break;
@@ -12665,37 +12659,37 @@ Scan complete: ${spamCount} spam emails detected`);
12665
12659
  default:
12666
12660
  console.log("Spam Management Commands:");
12667
12661
  console.log(
12668
- " mail-client spam mark <email-id> - Mark email as spam"
12662
+ " mail-cli spam mark <email-id> - Mark email as spam"
12669
12663
  );
12670
12664
  console.log(
12671
- " mail-client spam unmark <email-id> - Unmark email as spam"
12665
+ " mail-cli spam unmark <email-id> - Unmark email as spam"
12672
12666
  );
12673
12667
  console.log(
12674
- " mail-client spam list - List spam emails"
12668
+ " mail-cli spam list - List spam emails"
12675
12669
  );
12676
12670
  console.log(
12677
- " mail-client spam blacklist add <email> - Add to blacklist"
12671
+ " mail-cli spam blacklist add <email> - Add to blacklist"
12678
12672
  );
12679
12673
  console.log(
12680
- " mail-client spam blacklist remove <email> - Remove from blacklist"
12674
+ " mail-cli spam blacklist remove <email> - Remove from blacklist"
12681
12675
  );
12682
12676
  console.log(
12683
- " mail-client spam blacklist list - List blacklist"
12677
+ " mail-cli spam blacklist list - List blacklist"
12684
12678
  );
12685
12679
  console.log(
12686
- " mail-client spam whitelist add <email> - Add to whitelist"
12680
+ " mail-cli spam whitelist add <email> - Add to whitelist"
12687
12681
  );
12688
12682
  console.log(
12689
- " mail-client spam whitelist remove <email> - Remove from whitelist"
12683
+ " mail-cli spam whitelist remove <email> - Remove from whitelist"
12690
12684
  );
12691
12685
  console.log(
12692
- " mail-client spam whitelist list - List whitelist"
12686
+ " mail-cli spam whitelist list - List whitelist"
12693
12687
  );
12694
12688
  console.log(
12695
- " mail-client spam filter - Run spam filter on inbox"
12689
+ " mail-cli spam filter - Run spam filter on inbox"
12696
12690
  );
12697
12691
  console.log(
12698
- " mail-client spam stats - Show spam statistics"
12692
+ " mail-cli spam stats - Show spam statistics"
12699
12693
  );
12700
12694
  }
12701
12695
  } catch (error2) {
@@ -13289,7 +13283,7 @@ var require_sync = __commonJS({
13289
13283
  try {
13290
13284
  const cfg = config_default.load();
13291
13285
  if (!cfg.imap.host || !cfg.imap.user || !cfg.imap.password) {
13292
- spinner.fail("Configuration incomplete. Please run: mail-client config");
13286
+ spinner.fail("Configuration incomplete. Please run: mail-cli config");
13293
13287
  process.exit(1);
13294
13288
  }
13295
13289
  let folders = cfg.sync.folders || ["INBOX"];
@@ -14342,11 +14336,11 @@ var import_commander2 = require("commander");
14342
14336
  // package.json
14343
14337
  var package_default = {
14344
14338
  name: "open-mail-cli",
14345
- version: "1.0.0",
14339
+ version: "1.0.1",
14346
14340
  description: "A command-line email client with IMAP/SMTP support",
14347
14341
  main: "dist/index.js",
14348
14342
  bin: {
14349
- "email-cli": "./dist/index.js"
14343
+ "mail-cli": "./dist/index.js"
14350
14344
  },
14351
14345
  scripts: {
14352
14346
  build: "tsup",
@@ -14361,10 +14355,10 @@ var package_default = {
14361
14355
  format: 'prettier --write ".src/**/*.ts" ".tests/**/*.ts"',
14362
14356
  "format:check": 'prettier --check ".src/**/*.ts" ".tests/**/*.ts"',
14363
14357
  prepare: "husky",
14364
- "build:binary": "pnpm build && pkg dist/index.js --targets node18-macos-x64,node18-macos-arm64,node18-linux-x64,node18-linux-arm64,node18-win-x64 --output dist/binary/mail-client",
14365
- "build:binary:macos": "pnpm build && pkg dist/index.js --targets node18-macos-arm64 --output dist/binary/mail-client-macos",
14366
- "build:binary:linux": "pnpm build && pkg dist/index.js --targets node18-linux-x64 --output dist/binary/mail-client-linux",
14367
- "build:binary:windows": "pnpm build && pkg dist/index.js --targets node18-win-x64 --output dist/binary/mail-client.exe",
14358
+ "build:binary": "pnpm build && pkg dist/index.js --targets node18-macos-x64,node18-macos-arm64,node18-linux-x64,node18-linux-arm64,node18-win-x64 --output dist/binary/open-mail-cli",
14359
+ "build:binary:macos": "pnpm build && pkg dist/index.js --targets node18-macos-arm64 --output dist/binary/open-mail-cli-macos",
14360
+ "build:binary:linux": "pnpm build && pkg dist/index.js --targets node18-linux-x64 --output dist/binary/open-mail-cli-linux",
14361
+ "build:binary:windows": "pnpm build && pkg dist/index.js --targets node18-win-x64 --output dist/binary/open-mail-cli.exe",
14368
14362
  prepublishOnly: "pnpm build && pnpm lint"
14369
14363
  },
14370
14364
  "lint-staged": {
@@ -14974,7 +14968,7 @@ function promptConfirm2(message) {
14974
14968
  // src/cli/index.ts
14975
14969
  function createCLI() {
14976
14970
  const program = new import_commander2.Command();
14977
- program.name("mail-client").description("A command-line email client with IMAP/SMTP support").version(package_default.version);
14971
+ program.name("mail-cli").description("A command-line email client with IMAP/SMTP support").version(package_default.version);
14978
14972
  program.command("config").description("Configure IMAP and SMTP settings").option("--show", "Show current configuration").option("--set <key=value>", "Set a configuration value").action(import_config2.default);
14979
14973
  program.command("sync [action]").description("Synchronize emails from IMAP server").option("--folder <name>", "Sync specific folder (default: INBOX)").option("--folders <names>", "Sync multiple folders (comma-separated)").option("--since <date>", "Sync emails since date (YYYY-MM-DD)").option("--account <id>", "Sync specific account").option("--auto", "Start automatic sync mode").option(
14980
14974
  "--interval <minutes>",