@zhin.js/adapter-email 0.1.74 → 0.1.76

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +45 -12
  3. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @zhin.js/adapter-email
2
2
 
3
+ ## 0.1.76
4
+
5
+ ### Patch Changes
6
+
7
+ - c78d2cd: fix: cli 更新,文档更新
8
+ - Updated dependencies [c78d2cd]
9
+ - zhin.js@1.0.89
10
+
11
+ ## 0.1.75
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [ccb6e24]
16
+ - zhin.js@1.0.88
17
+
3
18
  ## 0.1.74
4
19
 
5
20
  ### Patch Changes
package/README.md CHANGED
@@ -16,10 +16,23 @@ Zhin.js 邮件适配器,通过 SMTP 发送和 IMAP 接收邮件,将邮箱作
16
16
  pnpm add @zhin.js/adapter-email
17
17
  ```
18
18
 
19
- ## 配置
19
+ ## 前置条件
20
+
21
+ | 要求 | 说明 |
22
+ |------|------|
23
+ | **邮箱账号** | 可用的 SMTP 发信与 IMAP 收信账号(或同一邮箱双协议) |
24
+ | **应用专用密码** | Gmail、Outlook 等常需开启「第三方应用访问」或生成应用密码 |
25
+ | **网络** | 出站可连 SMTP/IMAP 端口(465/587/993 等) |
26
+ | **host-router** | 不需要;IMAP 轮询在适配器内完成 |
27
+
28
+ 必填字段见 `EmailBotConfig`:`context`、`name`、`smtp`、`imap`(含 `auth.user` / `auth.pass` 与 `user` / `password`)。
29
+
30
+ ## 最小配置
20
31
 
21
32
  ```yaml
22
- # zhin.config.yml
33
+ plugins:
34
+ - "@zhin.js/adapter-email"
35
+
23
36
  bots:
24
37
  - context: email
25
38
  name: my-email-bot
@@ -29,19 +42,29 @@ bots:
29
42
  secure: true
30
43
  auth:
31
44
  user: bot@example.com
32
- pass: ${EMAIL_PASSWORD}
45
+ pass: "${EMAIL_PASSWORD}"
46
+ imap:
47
+ host: imap.example.com
48
+ port: 993
49
+ tls: true
50
+ user: bot@example.com
51
+ password: "${EMAIL_PASSWORD}"
52
+ ```
53
+
54
+ ## 配置
55
+
56
+ ### 可选 IMAP 字段
57
+
58
+ ```yaml
33
59
  imap:
34
60
  host: imap.example.com
35
61
  port: 993
36
62
  tls: true
37
63
  user: bot@example.com
38
- password: ${EMAIL_PASSWORD}
64
+ password: "${EMAIL_PASSWORD}"
39
65
  # checkInterval: 30000 # 轮询间隔(毫秒),默认 30 秒
40
66
  # mailbox: INBOX # 监听的邮箱文件夹
41
67
  # markSeen: true # 已读标记
42
-
43
- plugins:
44
- - adapter-email
45
68
  ```
46
69
 
47
70
  ### TypeScript 配置
@@ -72,7 +95,7 @@ export default defineConfig({
72
95
  },
73
96
  }
74
97
  ],
75
- plugins: ['adapter-email']
98
+ plugins: ['@zhin.js/adapter-email']
76
99
  })
77
100
  ```
78
101
 
@@ -107,11 +130,21 @@ addMiddleware(async (message, next) => {
107
130
  })
108
131
  ```
109
132
 
110
- ## 注意事项
133
+ ## 故障排查
134
+
135
+ | 现象 | 排查 |
136
+ |------|------|
137
+ | IMAP 连接失败 | 主机/端口/TLS 是否正确;是否需应用专用密码而非登录密码 |
138
+ | 收不到新邮件 | 默认轮询间隔 30s(`checkInterval`);检查 `mailbox` 是否为 `INBOX` |
139
+ | SMTP 发送失败 | `secure` 与端口匹配(465 通常 `secure: true`);发信地址与 `auth.user` 一致 |
140
+ | 重复处理邮件 | 确认 `markSeen: true`;检查是否多实例同时轮询同一邮箱 |
141
+
142
+ 建议使用环境变量存储邮箱密码,勿提交到版本库。
143
+
144
+ ## 文档链接
111
145
 
112
- - IMAP 接收使用轮询机制,`checkInterval` 控制轮询频率
113
- - 部分邮箱服务商需要开启"第三方应用访问"或"应用专用密码"
114
- - 建议使用环境变量存储邮箱密码
146
+ - [Email 适配器文档](https://zhin.js.org/adapters/email)
147
+ - [适配器概览](https://zhin.js.org/essentials/adapters)
115
148
 
116
149
  ## 许可证
117
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-email",
3
- "version": "0.1.74",
3
+ "version": "0.1.76",
4
4
  "type": "module",
5
5
  "description": "Zhin.js adapter for Email (SMTP/IMAP)",
6
6
  "main": "./lib/index.js",
@@ -11,7 +11,7 @@
11
11
  "nodemailer": "^8.0.10"
12
12
  },
13
13
  "peerDependencies": {
14
- "zhin.js": "1.0.87"
14
+ "zhin.js": "1.0.89"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@types/imap": "^0.8.40",
@@ -19,7 +19,7 @@
19
19
  "@types/node": "^25.9.1",
20
20
  "@types/nodemailer": "^8.0.0",
21
21
  "typescript": "^6.0.3",
22
- "zhin.js": "1.0.87"
22
+ "zhin.js": "1.0.89"
23
23
  },
24
24
  "keywords": [
25
25
  "zhin",