api_doc.html
48.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex,nofollow">
<title>mail 接口文档</title>
<style>
*{box-sizing:border-box;margin:0;padding:0;}
body{background:#f6f8fb;color:#22303f;font:14px/1.7 -apple-system,"Segoe UI","Microsoft YaHei",sans-serif;}
a{color:#2f6bd8;text-decoration:none;}
code,kbd{font-family:Consolas,Menlo,Monaco,monospace;font-size:12.5px;}
/* 顶栏 */
.top{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:16px;
height:56px;padding:0 22px;background:#fff;border-bottom:1px solid #e4eaf2;}
.top .logo{display:flex;align-items:center;gap:10px;font-size:15px;font-weight:600;white-space:nowrap;}
.top .logo i{display:inline-block;width:8px;height:18px;border-radius:3px;background:#2f6bd8;}
.top .meta{color:#93a1b3;font-size:12px;white-space:nowrap;}
.top .meta b{color:#5b6b7e;font-weight:500;}
.top .grow{flex:1;}
.search{position:relative;}
.search input{width:260px;height:34px;padding:0 12px 0 30px;border:1px solid #dde5ef;border-radius:8px;
outline:none;font-size:13px;background:#f8fafd;transition:.15s;}
.search input:focus{border-color:#7ba4e6;background:#fff;box-shadow:0 0 0 3px rgba(74,127,214,.1);}
.search svg{position:absolute;left:9px;top:9px;width:15px;height:15px;fill:#9aa8ba;}
.quit{font-size:13px;color:#8592a4;padding:4px 10px;border:1px solid #e2e9f1;border-radius:6px;}
.quit:hover{color:#d0342c;border-color:#f3c9c6;background:#fef7f7;}
/* 布局 */
.wrap{display:flex;align-items:flex-start;gap:0;}
.side{position:sticky;top:56px;width:250px;flex:0 0 250px;height:calc(100vh - 56px);overflow-y:auto;
padding:16px 10px 40px 22px;border-right:1px solid #e8eef6;background:#fff;}
.side h4{margin:16px 0 6px;color:#96a3b5;font-size:11.5px;font-weight:600;letter-spacing:.5px;}
.side h4:first-child{margin-top:0;}
.side a{display:block;padding:5px 10px;border-radius:6px;color:#4a5a6d;font-size:13px;
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.side a:hover{background:#f2f6fc;color:#2f6bd8;}
.side a.on{background:#eaf1fd;color:#2f6bd8;font-weight:600;}
.main{flex:1;min-width:0;padding:26px 36px 90px;max-width:1080px;}
/* 内容 */
.main > h1{font-size:22px;margin-bottom:6px;}
.main > .lead{color:#7d8b9c;font-size:13px;margin-bottom:24px;}
.card{background:#fff;border:1px solid #e8eef6;border-radius:10px;padding:18px 20px;margin-bottom:16px;}
.card h3{font-size:14px;margin-bottom:10px;color:#2a3a4d;}
.api{background:#fff;border:1px solid #e8eef6;border-radius:10px;padding:0 20px 18px;margin-bottom:16px;
scroll-margin-top:70px;}
.api > .head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;
padding:16px 0 12px;border-bottom:1px dashed #eef2f8;margin-bottom:14px;}
.api > .head .path{font-size:14px;font-weight:600;color:#1f3f6b;background:#f5f8fd;
padding:3px 8px;border-radius:5px;cursor:pointer;}
.api > .head .path:hover{background:#e9f0fb;}
.api > .head .name{color:#5c6b7d;font-size:13px;}
.m{display:inline-block;min-width:48px;text-align:center;padding:2px 8px;border-radius:5px;
font-size:11px;font-weight:600;letter-spacing:.3px;}
.m.post{background:#e7f0ff;color:#2f6bd8;}
.m.get{background:#e5f6ec;color:#1c8a4c;}
.m.any{background:#f0eefb;color:#6a52c4;}
.desc{color:#5f6f82;font-size:13px;margin-bottom:12px;}
.desc:last-child{margin-bottom:0;}
table{width:100%;border-collapse:collapse;font-size:13px;margin:4px 0 12px;}
th,td{text-align:left;padding:7px 10px;border-bottom:1px solid #eff3f8;vertical-align:top;}
th{background:#f8fafd;color:#7b899b;font-weight:500;font-size:12px;white-space:nowrap;}
td:first-child{white-space:nowrap;}
td code{color:#255cc0;background:#f4f8fe;padding:1px 5px;border-radius:4px;}
.req{color:#d0342c;font-size:11px;}
.opt{color:#a7b3c2;font-size:11px;}
pre{background:#f8fafd;border:1px solid #edf1f7;border-radius:8px;padding:12px 14px;
overflow:auto;font-size:12.5px;line-height:1.6;color:#33475f;}
.tip{margin:10px 0 0;padding:9px 12px;background:#fff9ec;border-left:3px solid #f0b429;
border-radius:0 6px 6px 0;color:#7a6320;font-size:12.5px;}
.warn{background:#fdf2f1;border-left-color:#e0645b;color:#8f2f28;}
.hide{display:none !important;}
.empty{padding:60px 0;text-align:center;color:#9aa8ba;}
@media (max-width:900px){
.side{display:none;}
.main{padding:20px 16px 60px;}
.search input{width:150px;}
.top .meta{display:none;}
}
</style>
</head>
<body>
<div class="top">
<div class="logo"><i></i>mail 接口文档</div>
<div class="meta">接口地址 <b><!--{#host#}--></b></div>
<div class="meta">生成时间 <b><!--{#time#}--></b></div>
<div class="grow"></div>
<div class="search">
<svg viewBox="0 0 1024 1024"><path d="M448 128a320 320 0 1 1 0 640 320 320 0 0 1 0-640zm0 96a224 224 0 1 0 0 448 224 224 0 0 0 0-448zm256 480 224 224-68 68-224-224z"/></svg>
<input id="q" type="text" placeholder="搜索接口 / 参数">
</div>
<a class="quit" href="/api-doc/logout">退出</a>
</div>
<div class="wrap">
<nav class="side" id="side">
<h4>概述</h4>
<a href="#common">通用说明</a>
<a href="#login">登录授权</a>
<h4>邮件</h4>
<a href="#lists">邮件列表</a>
<a href="#lists-count">邮箱统计</a>
<a href="#info">邮件详情</a>
<a href="#mailbody">邮件正文</a>
<a href="#mail-flag">标记已读 / 星标</a>
<a href="#mail-move">移动 / 复制邮件</a>
<a href="#mail-expunge">清空回收站</a>
<a href="#mail-check">邮箱状态检测</a>
<h4>发信</h4>
<a href="#send">发送邮件</a>
<a href="#job">发送任务列表</a>
<a href="#job-ops">任务启停 / 详情</a>
<h4>同步</h4>
<a href="#sync">同步邮件</a>
<a href="#sync-v2">v2 / v3 同步</a>
<a href="#resync">重建 ES 索引</a>
<h4>文件夹</h4>
<a href="#folder">文件夹树</a>
<a href="#folder-create">新建 / 重命名</a>
<a href="#folder-delete">删除文件夹</a>
<h4>上传与其他</h4>
<a href="#upload">上传文件</a>
<a href="#other">其他接口</a>
<h4>项目专用(fob)</h4>
<a href="#fob-lists">项目邮件列表</a>
<a href="#fob-count">项目邮件统计</a>
<a href="#fob-es">ES 版本列表</a>
<a href="#fob-search">AI 邮件搜索</a>
<a href="#fob-reply-count">模板回复统计</a>
</nav>
<main class="main" id="main">
<h1>mail 接口文档</h1>
<p class="lead">邮件同步、收发、文件夹与发送任务的接口说明。所有接口均以 json 作为响应体。</p>
<!-- 通用说明 -->
<section class="card" id="common">
<h3>通用说明</h3>
<table>
<tr><th style="width:120px">项目</th><th>说明</th></tr>
<tr><td>请求方式</td><td>接口同时支持 GET 与 POST。业务上建议统一使用 <code>POST</code>;不带参数的调试查询可用 GET。</td></tr>
<tr><td>参数提交</td><td>支持表单(<code>application/x-www-form-urlencoded</code>)、<code>multipart/form-data</code>(上传)以及 json body。<br>json body 会与表单参数合并,同名时以表单参数为准。</td></tr>
<tr><td>参数类型</td><td>所有标量参数会被自动 trim;小于 10 位的纯数字会转成 int,带小数点转 float。<br>数组参数建议使用 <code>key[]=a&key[]=b</code> 或直接传 json 数组字符串。</td></tr>
<tr><td>通用邮箱参数</td><td><code>emails</code>:一个或多个邮箱地址,支持 <code>a@x.com,b@x.com</code> 逗号分隔、<code>["a@x.com"]</code> json 数组。<br><code>email</code>:单个邮箱地址(单邮箱接口使用)。<br>两者必须都是合法邮箱,否则直接返回错误。</td></tr>
<tr><td>响应格式</td><td>成功时直接返回业务数据;分页接口统一返回 <code>{"item":[],"page":1,"total":0,"limit":20}</code>。<br>失败时返回 <code>{"error_message":"错误说明","status":400}</code>。</td></tr>
<tr><td>HTTP 状态码</td><td>统一返回 200,业务成功与否请以响应体是否包含 <code>error_message</code> 判断。</td></tr>
<tr><td>分页参数</td><td><code>page</code> 页码从 1 开始(默认 1);<code>limit</code> 每页条数(默认 20)。</td></tr>
</table>
<p class="tip">注意:本服务不维护会话登录态,除本页面的访问密码外,接口本身按邮箱维度操作数据。请只在受信内网环境中调用。</p>
</section>
<!-- 登录 -->
<article class="api" id="login">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/login">/login</code>
<span class="name">登录 / 绑定邮箱</span>
</div>
<p class="desc">校验邮箱账号的 IMAP 与 SMTP 是否可登录,成功后保存(或更新)邮箱记录,并立即同步一次文件夹。</p>
<table>
<tr><th style="width:130px">参数</th><th style="width:80px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>email</code></td><td>string</td><td class="req">是</td><td>邮箱地址</td></tr>
<tr><td><code>password</code></td><td>string</td><td class="req">是</td><td>邮箱密码或客户端授权码(入库时 base64 存储)</td></tr>
<tr><td><code>imap</code></td><td>string</td><td class="req">是</td><td>IMAP 服务器,如 <code>imap.qq.com</code></td></tr>
<tr><td><code>smtp</code></td><td>string</td><td class="req">是</td><td>SMTP 服务器,如 <code>smtp.qq.com</code></td></tr>
</table>
<pre>{
"id": 1024,
"email": "demo@qq.com",
"imap": "imap.qq.com",
"smtp": "smtp.qq.com",
"status": 1,
"created_at": "2026-10-23 10:00:00"
}</pre>
</article>
<!-- 邮件列表 -->
<article class="api" id="lists">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/lists">/lists</code>
<span class="name">邮件列表(ES 搜索)</span>
</div>
<p class="desc">基于 Elasticsearch 的邮件列表,支持文件夹、时间、已读、星标、附件、联系人、标题关键字等组合筛选。</p>
<table>
<tr><th style="width:150px">参数</th><th style="width:90px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>emails</code></td><td>string/array</td><td class="req">是</td><td>邮箱地址,多个用逗号分隔</td></tr>
<tr><td><code>postid</code></td><td>int</td><td class="opt">否</td><td>项目 id。传了会查 <code>email_lists_branch_{postid}</code> 索引,不传查 <code>email_lists_all</code></td></tr>
<tr><td><code>page</code></td><td>int</td><td class="opt">否</td><td>页码,默认 1</td></tr>
<tr><td><code>limit</code></td><td>int</td><td class="opt">否</td><td>每页条数,默认 20</td></tr>
<tr><td><code>folder</code></td><td>string</td><td class="opt">否</td><td>文件夹名,默认 <code>收件箱</code>。支持 <code>收件箱/发件箱/草稿箱/垃圾箱/回收站</code> 及自定义文件夹</td></tr>
<tr><td><code>folder_id</code></td><td>array</td><td class="opt">否</td><td>直接按文件夹 id 查询,优先于 <code>folder</code></td></tr>
<tr><td><code>mail_id</code> / <code>mail_ids</code></td><td>array</td><td class="opt">否</td><td>指定邮件 uuid,只返回这些邮件</td></tr>
<tr><td><code>udate</code></td><td>array</td><td class="opt">否</td><td>时间范围,必须 2 个元素:<code>udate[0]</code> 开始、<code>udate[1]</code> 结束,支持时间戳或日期字符串</td></tr>
<tr><td><code>seen</code></td><td>int</td><td class="opt">否</td><td><code>0</code> 未读 / <code>1</code> 已读,不传或 -1 不限</td></tr>
<tr><td><code>flagged</code></td><td>int</td><td class="opt">否</td><td><code>0</code> 未星标 / <code>1</code> 星标</td></tr>
<tr><td><code>answered</code></td><td>bool</td><td class="opt">否</td><td>是否已回复,传了就按该值过滤</td></tr>
<tr><td><code>attachment</code></td><td>int</td><td class="opt">否</td><td><code>0</code> 无附件 / <code>1</code> 有附件</td></tr>
<tr><td><code>deleted</code></td><td>int</td><td class="opt">否</td><td>是否软删,默认 0(不查已删)</td></tr>
<tr><td><code>keyword</code></td><td>string</td><td class="opt">否</td><td>标题关键字(精确短语匹配)</td></tr>
<tr><td><code>address</code></td><td>string/array</td><td class="opt">否</td><td>字符串:按发件人或收件人匹配;数组:<code>address[from]</code> 发件人、<code>address[to]</code> 收件人</td></tr>
<tr><td><code>from</code></td><td>string/array</td><td class="opt">否</td><td>发件人过滤;在发件箱下按收件人(to)匹配</td></tr>
<tr><td><code>from_not_in</code></td><td>array</td><td class="opt">否</td><td>排除这些发件人</td></tr>
<tr><td><code>formorto</code></td><td>string</td><td class="opt">否</td><td><code>from</code> 只看自己发的;<code>to</code> 只看别人发来的</td></tr>
<tr><td><code>search_tags</code></td><td>bool</td><td class="opt">否</td><td>配合 <code>mail_ids</code>:按这些邮件的联系人为线索,扩展出同一会话的所有邮件</td></tr>
</table>
<pre>{
"item": [
{
"id": 88123,
"uuid": "a1b2c3...",
"subject": "Re: 报价单确认",
"from": "client@example.com",
"from_name": "张三",
"to": "demo@qq.com",
"to_name": "demo",
"udate": 1761200000,
"size": 48123,
"seen": 0,
"flagged": 0,
"answered": 0,
"is_file": 1,
"deleted": 0,
"folder_id": 12,
"folder_name": "收件箱",
"description": "邮件摘要文本"
}
],
"page": 1,
"total": 236,
"limit": 20
}</pre>
<p class="tip">列表里的 <code>id</code> 即 ES 中的 <code>uuid</code>,可直接用于详情、标记、移动等接口。</p>
</article>
<!-- 统计 -->
<article class="api" id="lists-count">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/count">/count</code>
<span class="name">邮箱统计</span>
</div>
<p class="desc">统计收件箱总数、未读数、发件箱总数,可按时间范围过滤。</p>
<table>
<tr><th style="width:130px">参数</th><th style="width:80px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>emails</code></td><td>string/array</td><td class="req">是</td><td>邮箱地址</td></tr>
<tr><td><code>start_time</code></td><td>int</td><td class="opt">否</td><td>开始时间戳(udate 大于等于)</td></tr>
<tr><td><code>end_time</code></td><td>int</td><td class="opt">否</td><td>结束时间戳(udate 小于等于)</td></tr>
<tr><td><code>show</code></td><td>string</td><td class="opt">否</td><td>传 <code>inbox</code> 时只返回收件箱数量</td></tr>
</table>
<pre>{"inbox": 1280, "unseen": 12, "send": 654}</pre>
</article>
<!-- 详情 -->
<article class="api" id="info">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/info">/info</code>
<span class="name">邮件详情</span>
</div>
<p class="desc">读取邮件头信息与正文结构。本地无正文时会自动触发一次 IMAP 拉取后重试。</p>
<table>
<tr><th style="width:130px">参数</th><th style="width:80px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>id</code></td><td>int</td><td class="req">是</td><td>邮件列表 id(<code>lists</code> 返回的 id)</td></tr>
<tr><td><code>emails</code></td><td>string/array</td><td class="opt">否</td><td>按 id 定位到邮箱后可省略</td></tr>
<tr><td><code>reload</code></td><td>int</td><td class="opt">否</td><td><code>1</code> 忽略本地缓存正文,重新拉取</td></tr>
<tr><td><code>udate</code> + <code>subject</code></td><td>int / string</td><td class="opt">否</td><td>同时传时按 id + 时间精确定位(跨邮箱场景)</td></tr>
<tr><td><code>postid</code></td><td>int</td><td class="opt">否</td><td>项目 id,用于回读该邮件所属项目</td></tr>
</table>
<pre>{
"data": {
"id": 88123,
"subject": "Re: 报价单确认",
"from": "client@example.com",
"to_name": [{"email": "demo@qq.com", "name": "demo"}],
"cc": [],
"bcc": [],
"udate": 1761200000,
"folder_id": 12,
"allowreply": 1,
"postid": 0,
"body": [
{"type": "text/html", "body": "base64内容"},
{"type": "application/pdf", "name": "quote.pdf", "signName": "xxx.pdf", "size": 10240, "url": "http://.../xxx.pdf"}
]
}
}</pre>
<p class="tip">正文段落里 <code>body</code> 字段是 base64 编码内容;带 <code>path</code> 的段落为附件,会额外返回 <code>size</code> 与 <code>url</code>。</p>
</article>
<!-- 正文 -->
<article class="api" id="mailbody">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/mailbody">/mailbody</code>
<span class="name">只取邮件正文</span>
</div>
<p class="desc">只返回正文结构数组,不返回邮件头信息。适用于正文懒加载。</p>
<table>
<tr><th style="width:130px">参数</th><th style="width:80px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>list_id</code></td><td>int</td><td class="req">是</td><td>邮件列表 id</td></tr>
</table>
<pre>[{"type": "text/html", "body": "base64内容"}]</pre>
</article>
<!-- 标记 -->
<article class="api" id="mail-flag">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/seen_2_unseen /answered_2_unanswered /star_2_unstar">/seen_2_unseen /answered_2_unanswered /star_2_unstar</code>
<span class="name">标记已读 / 已回复 / 星标</span>
</div>
<p class="desc">三个接口参数结构一致,分别对应已读状态、回复状态、星标状态;会同步更新 IMAP 服务端标记。</p>
<table>
<tr><th style="width:130px">参数</th><th style="width:80px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>emails</code></td><td>string/array</td><td class="req">是</td><td>邮箱地址</td></tr>
<tr><td><code>mail_ids</code></td><td>array</td><td class="req">是</td><td>邮件 id 列表</td></tr>
<tr><td><code>seen</code> / <code>answered</code> / <code>flagged</code></td><td>int</td><td class="req">是</td><td>目标状态:<code>1</code> 打标 / <code>0</code> 取消。<br>标记已读接口传 <code>seen</code>,回复接口传 <code>answered</code>,星标接口传 <code>flagged</code></td></tr>
<tr><td><code>postid</code></td><td>int</td><td class="opt">否</td><td>项目 id,用于在对应分支索引中定位邮件</td></tr>
</table>
<pre>{"mail_id": [88123, 88124]}</pre>
</article>
<!-- 移动复制 -->
<article class="api" id="mail-move">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/move /copy">/move /copy</code>
<span class="name">移动 / 复制邮件</span>
</div>
<p class="desc">把邮件移动(复制后删除原邮件)或复制到目标文件夹。移动到 <code>回收站</code> 时只做软删。</p>
<table>
<tr><th style="width:130px">参数</th><th style="width:80px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>emails</code></td><td>string/array</td><td class="req">是</td><td>邮箱地址</td></tr>
<tr><td><code>mail_ids</code></td><td>array</td><td class="req">是</td><td>邮件 id 列表</td></tr>
<tr><td><code>folder</code></td><td>string</td><td class="req">是</td><td>目标文件夹(别名或自定义名)。不支持 <code>草稿箱</code>、<code>发件箱</code></td></tr>
</table>
<pre>{"mail_id": [88123]}</pre>
</article>
<!-- 清空 -->
<article class="api" id="mail-expunge">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/expunge">/expunge</code>
<span class="name">清空回收站(expunge)</span>
</div>
<p class="desc">对当前邮箱执行 IMAP expunge,真正删除已标记删除的邮件。</p>
<table>
<tr><th style="width:130px">参数</th><th style="width:80px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>email</code></td><td>string</td><td class="req">是</td><td>邮箱地址</td></tr>
</table>
<pre>{}</pre>
</article>
<!-- 状态检测 -->
<article class="api" id="mail-check">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/check">/check</code>
<span class="name">邮箱密码状态检测</span>
</div>
<p class="desc">逐个尝试 IMAP 登录,更新邮箱的密码错误状态。多个邮箱时直接返回库里的状态,不再逐个登录。</p>
<table>
<tr><th style="width:130px">参数</th><th style="width:80px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>emails</code></td><td>string/array</td><td class="req">是</td><td>邮箱地址</td></tr>
</table>
<pre>{"demo@qq.com": 0, "other@163.com": 1}</pre>
<p class="desc" style="margin-top:10px">值为 <code>1</code> 表示该邮箱密码不可用,需要重新登录绑定。</p>
</article>
<!-- 发信 -->
<article class="api" id="send">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/send">/send</code>
<span class="name">发送邮件</span>
</div>
<p class="desc">支持立即发送、定时发送、群发单显、存草稿;四种模式由参数组合决定,返回结构不同。</p>
<table>
<tr><th style="width:170px">参数</th><th style="width:110px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>email</code></td><td>string</td><td class="req">是</td><td>发件邮箱地址</td></tr>
<tr><td><code>tos</code></td><td>array</td><td class="req">是</td><td>收件人,最多 100 个。元素为 <code>{"email":"","name":""}</code> 或纯邮箱字符串</td></tr>
<tr><td><code>subject</code></td><td>string</td><td class="req">是</td><td>标题,最长 500 字</td></tr>
<tr><td><code>body</code></td><td>string</td><td class="req">是</td><td>正文 HTML,会清除 script 标签</td></tr>
<tr><td><code>nickname</code></td><td>string</td><td class="opt">否</td><td>发件人显示名,最长 50 字</td></tr>
<tr><td><code>cc</code></td><td>array</td><td class="opt">否</td><td>抄送,需要同时传 <code>isCc=1</code>,最多 10 个</td></tr>
<tr><td><code>bcc</code></td><td>array</td><td class="opt">否</td><td>密送,需要同时传 <code>isBcc=1</code>,最多 10 个</td></tr>
<tr><td><code>priority</code></td><td>int</td><td class="opt">否</td><td>优先级:<code>1</code> 高 / <code>3</code> 普通 / <code>5</code> 低,默认 3</td></tr>
<tr><td><code>receipt</code></td><td>int</td><td class="opt">否</td><td>传 1 表示需要已读回执</td></tr>
<tr><td><code>attachment</code></td><td>file</td><td class="opt">否</td><td>直接上传附件(multipart),字段名 <code>attachment[]</code></td></tr>
<tr><td><code>attachmentapi</code></td><td>array</td><td class="opt">否</td><td>使用 <code>/upload/file</code> 上传后的结果 JSON 字符串数组</td></tr>
<tr><td><code>attachmentUrl</code></td><td>array</td><td class="opt">否</td><td>远程附件:<code>[{"url":"http://...","name":"a.pdf"}]</code></td></tr>
<tr><td><code>saveType</code></td><td>string</td><td class="opt">否</td><td>传 <code>draft</code> 表示存草稿,可配合 <code>draft_id</code> 覆盖已有草稿</td></tr>
<tr><td><code>timer</code> + <code>timerValue</code></td><td>int</td><td class="opt">否</td><td>定时发送。<code>timer=1</code> 且 <code>timerValue</code> 为相对秒数或时间字符串,且时间大于当前时间才生效</td></tr>
<tr><td><code>massSuit</code></td><td>int</td><td class="opt">否</td><td>传 1 表示群发单显,进入发送任务队列</td></tr>
<tr><td><code>masssuit_interval_send</code></td><td>array</td><td class="opt">否</td><td>群发间隔秒数:<code>{"start":30,"end":90}</code></td></tr>
<tr><td><code>jobName</code></td><td>string</td><td class="opt">否</td><td>任务名称,不传用标题</td></tr>
<tr><td><code>aicc-hot</code></td><td>bool</td><td class="opt">否</td><td>传任意值表示预热邮件,会追加 <code>Aicc-Hot-Mail: hot</code> 头</td></tr>
<tr><td><code>not_proxy</code></td><td>bool</td><td class="opt">否</td><td>不使用发信代理,直连发送</td></tr>
</table>
<pre>// 立即发送
{"messageId": "xxx@qq.com"}
// 定时发送 / 群发单显
{"job_id": 556}
// 存草稿
{"draft_id": 1024}</pre>
</article>
<!-- 任务列表 -->
<article class="api" id="job">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/job">/job</code>
<span class="name">发送任务列表</span>
</div>
<p class="desc">按邮箱查询发送任务,会自动校正执行中任务的成功 / 失败数量。</p>
<table>
<tr><th style="width:130px">参数</th><th style="width:80px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>emails</code></td><td>string/array</td><td class="req">是</td><td>邮箱地址</td></tr>
<tr><td><code>page</code> / <code>limit</code></td><td>int</td><td class="opt">否</td><td>分页</td></tr>
</table>
<pre>{"item":[{"id":556,"title":"9月新品","total":100,"success":98,"error":2,"status":2}],"page":1,"total":8,"limit":20}</pre>
<p class="desc" style="margin-top:10px"><code>status</code>:<code>0</code> 待发送 / <code>1</code> 发送中 / <code>2</code> 已完成 / <code>3</code> 已暂停。</p>
</article>
<!-- 任务操作 -->
<article class="api" id="job-ops">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/job/stop /job/start /job/detail /job/info /job/save">/job/stop /job/start /job/detail /job/info /job/save</code>
<span class="name">任务启停 / 详情 / 保存</span>
</div>
<table>
<tr><th style="width:150px">接口</th><th style="width:190px">参数</th><th>说明</th></tr>
<tr><td><code>/job/stop</code></td><td><code>id</code>、<code>emails</code></td><td>暂停任务,返回 <code>{"status":200}</code></td></tr>
<tr><td><code>/job/start</code></td><td><code>id</code>、<code>emails</code></td><td>继续任务,返回 <code>{"status":200}</code></td></tr>
<tr><td><code>/job/info</code></td><td><code>id</code>、<code>emails</code></td><td>返回任务完整记录,含 <code>maildata</code>(收件人、正文等)</td></tr>
<tr><td><code>/job/detail</code></td><td><code>id</code> 必填、<code>status</code>、<code>page</code>、<code>limit</code>、<code>is_export</code></td><td>返回每个收件人的发送明细,分页结构。<code>to_email</code> 为 <code>all</code> 时会展开成完整收件人列表</td></tr>
<tr><td><code>/job/save</code></td><td><code>id</code>、<code>subject</code>、<code>body</code></td><td>修改待发送任务的标题与正文,返回 <code>{"status":200,"message":"保存成功"}</code></td></tr>
</table>
</article>
<!-- 同步 -->
<article class="api" id="sync">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/sync">/sync</code>
<span class="name">触发邮件同步</span>
</div>
<p class="desc">把邮箱投递到同步队列(由常驻进程消费),或立即同步一次。同时可更新黑名单。</p>
<table>
<tr><th style="width:150px">参数</th><th style="width:100px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>emails</code></td><td>string/array</td><td class="req">是</td><td>邮箱地址</td></tr>
<tr><td><code>sync_type</code></td><td>string</td><td class="opt">否</td><td>传 <code>immediately</code> 立即同步(10 分钟内只执行一次);否则进队列</td></tr>
<tr><td><code>source</code></td><td>int</td><td class="opt">否</td><td>传 <code>1</code> 时投递到个人邮箱队列 <code>sync_email_lists_my</code></td></tr>
<tr><td><code>blacklist</code></td><td>array</td><td class="opt">否</td><td><code>{"emails":[],"domain":[]}</code>,同步时跳过这些发件人 / 域名,7 天有效;传空数组表示清空</td></tr>
</table>
<pre>[{"id":1024,"email":"demo@qq.com","pwd_error":0,"have_new":1}]</pre>
</article>
<article class="api" id="sync-v2">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/v2/sync /v3/sync">/v2/sync /v3/sync</code>
<span class="name">按时间同步(v2 / v3)</span>
</div>
<table>
<tr><th style="width:150px">接口</th><th style="width:190px">参数</th><th>说明</th></tr>
<tr><td><code>/v2/sync</code></td><td><code>email</code> 必填、<code>udate</code> 必填(时间戳)</td><td>同步该时间之后的所有邮件,返回字符串 <code>ok</code>;缺 udate 返回 <code>no udate</code></td></tr>
<tr><td><code>/v3/sync</code></td><td><code>id</code> 邮箱记录 id</td><td>同步当天的邮件,返回 <code>ok</code> 或同步数量数组</td></tr>
</table>
</article>
<article class="api" id="resync">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/resync_to_es /my_resync_to_es">/resync_to_es /my_resync_to_es</code>
<span class="name">重建 ES 索引</span>
</div>
<table>
<tr><th style="width:180px">接口</th><th style="width:160px">参数</th><th>说明</th></tr>
<tr><td><code>/resync_to_es</code></td><td><code>postid</code> 项目 id</td><td>把项目邮件重新刷入 ES。同一项目 10 分钟内只能提交一次;<code>postid=0</code>(全量)只允许在 18 点后或 6 点前执行。<br><code>postid=0a</code> 为特殊全量通道。提交后异步执行,5-15 分钟完成</td></tr>
<tr><td><code>/my_resync_to_es</code></td><td><code>email_id</code> 邮箱记录 id</td><td>把某个个人邮箱的全部邮件重刷入 ES,返回提交的邮件条数</td></tr>
</table>
</article>
<!-- 文件夹 -->
<article class="api" id="folder">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/folder">/folder</code>
<span class="name">文件夹树</span>
</div>
<p class="desc">返回每个邮箱的文件夹树,含邮件总数与未读数。</p>
<table>
<tr><th style="width:130px">参数</th><th style="width:90px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>emails</code></td><td>string/array</td><td class="opt">否</td><td>邮箱地址;不存在时回退到单个 <code>email</code></td></tr>
<tr><td><code>shishi</code></td><td>bool</td><td class="opt">否</td><td>传任意值表示实时统计(走 ES count,较慢但准确)</td></tr>
</table>
<pre>{
"demo@qq.com": [
{"id":12,"folder":"收件箱","pid":0,"exsts":1280,"unseen":12,"_child":[]},
{"id":13,"folder":"发件箱","pid":0,"exsts":654,"unseen":0,"_child":[]}
]
}</pre>
</article>
<article class="api" id="folder-create">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/folder/create">/folder/create</code>
<span class="name">新建 / 重命名文件夹</span>
</div>
<table>
<tr><th style="width:130px">参数</th><th style="width:90px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>email</code></td><td>string</td><td class="req">是</td><td>邮箱地址</td></tr>
<tr><td><code>folder</code></td><td>string</td><td class="req">是</td><td>文件夹名,会自动过滤特殊字符;不能与系统文件夹重名</td></tr>
<tr><td><code>pid</code></td><td>int</td><td class="opt">否</td><td>上级文件夹 id,最多两级</td></tr>
<tr><td><code>id</code></td><td>int</td><td class="opt">否</td><td>传了表示对该文件夹重命名</td></tr>
</table>
<p class="desc">返回该邮箱最新的文件夹树(结构同 <code>/folder</code>)。</p>
</article>
<article class="api" id="folder-delete">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/folder/delete">/folder/delete</code>
<span class="name">删除文件夹</span>
</div>
<table>
<tr><th style="width:130px">参数</th><th style="width:90px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>email</code></td><td>string</td><td class="req">是</td><td>邮箱地址</td></tr>
<tr><td><code>id</code></td><td>int</td><td class="req">是</td><td>文件夹 id</td></tr>
</table>
<p class="desc">系统文件夹不可删除;存在子文件夹或文件夹内还有邮件时会报错。成功返回被删除的文件夹记录。</p>
<p class="tip" style="margin-bottom:14px"><code>/folder/rename</code> 路由保留但方法为空(重命名请用 <code>/folder/create</code> 传 <code>id</code>)。</p>
</article>
<!-- 上传 -->
<article class="api" id="upload">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/upload/image /upload/file">/upload/image /upload/file</code>
<span class="name">上传图片 / 文件</span>
</div>
<table>
<tr><th style="width:150px">接口</th><th style="width:130px">参数</th><th>说明</th></tr>
<tr><td><code>/upload/image</code></td><td><code>files[]</code></td><td>图片,仅 jpg / jpeg / png / gif,单个最大 2MB。返回 <code>[{"name":"","saveUrl":""}]</code></td></tr>
<tr><td><code>/upload/file</code></td><td><code>files[]</code></td><td>任意文件,单个最大 200MB。返回 <code>[{"name":"","saveName":"","saveUrl":""}]</code></td></tr>
</table>
<pre>[{"name":"报价单.pdf","saveName":"xxx.pdf","saveUrl":"http://.../xxx.pdf"}]</pre>
<p class="tip">发信时把 <code>/upload/file</code> 返回的整条 JSON 字符串放进 <code>send</code> 接口的 <code>attachmentapi</code> 数组即可作为附件。</p>
</article>
<!-- 其他 -->
<article class="api" id="other">
<div class="head">
<span class="m any">GET/POST</span>
<code class="path" data-path="/desubscribe /proxy/server /show.attachment.fob">/desubscribe /proxy/server /show.attachment.fob</code>
<span class="name">其他接口</span>
</div>
<table>
<tr><th style="width:190px">接口</th><th style="width:220px">参数</th><th>说明</th></tr>
<tr><td><code>/desubscribe</code></td><td><code>key</code></td><td>解析退订链接参数,反解出退订地址</td></tr>
<tr><td><code>/proxy/server</code></td><td><code>email</code>、<code>imap</code>、<code>smtp</code>、<code>default</code></td><td>分配收发信代理 IP,返回 <code>{"imap_proxy":"","smtp_proxy":""}</code></td></tr>
<tr><td><code>/show.attachment.fob</code></td><td><code>path</code></td><td>附件预览。支持图片、音视频、pdf、txt、eml、html 等,其它类型返回提示文案</td></tr>
<tr><td><code>/kibana</code>、<code>/kibana.result</code></td><td>页面 / <code>json</code> ES 查询体</td><td>ES 查询调试页,仅公司 IP 可访问</td></tr>
</table>
<p class="tip warn">附件预览接口按 <code>path</code> 直接读 public 目录下的文件,务必只在内网开放,且不要把用户可控路径直接透传。</p>
</article>
<!-- fob 列表 -->
<article class="api" id="fob-lists">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/fob/lists">/fob/lists</code>
<span class="name">项目邮件列表(fob 专用)</span>
</div>
<p class="desc">按项目(<code>postid</code>)维度查询 ai 邮件,走项目的分支索引,字段结构与 <code>/lists</code> 类似。</p>
<table>
<tr><th style="width:160px">参数</th><th style="width:100px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>emails</code></td><td>string/array</td><td class="req">是</td><td>邮箱地址</td></tr>
<tr><td><code>postid</code></td><td>int</td><td class="req">是</td><td>项目 id,决定索引与数据隔离</td></tr>
<tr><td><code>folder</code></td><td>string</td><td class="opt">否</td><td>只支持 <code>收件箱</code>、<code>发件箱</code>、<code>草稿箱</code>、<code>垃圾箱</code>、<code>星标邮件</code>/<code>Starred</code>、<code>预热收件箱</code>、<code>预热发件箱</code>、<code>自动回复收件箱</code>;传其它值等同全部</td></tr>
<tr><td><code>page</code> / <code>limit</code></td><td>int</td><td class="opt">否</td><td>分页,默认 1 / 20</td></tr>
<tr><td><code>mail_id</code></td><td>array</td><td class="opt">否</td><td>指定邮件 id</td></tr>
<tr><td><code>seen</code></td><td>int</td><td class="opt">否</td><td><code>0</code> 未读 / <code>1</code> 已读</td></tr>
<tr><td><code>answered</code></td><td>bool</td><td class="opt">否</td><td>是否已回复</td></tr>
<tr><td><code>keyword</code></td><td>string</td><td class="opt">否</td><td>标题关键字</td></tr>
<tr><td><code>address</code></td><td>string/array</td><td class="opt">否</td><td>联系人过滤,数组用 <code>from</code> 键;发件箱下自动转为按收件人匹配</td></tr>
<tr><td><code>attachment</code></td><td>bool</td><td class="opt">否</td><td>是否有附件</td></tr>
<tr><td><code>assign</code></td><td>array</td><td class="opt">否</td><td>按分配规则过滤,结构由项目侧约定</td></tr>
<tr><td><code>from_not_in_like</code></td><td>array</td><td class="opt">否</td><td>排除发件人(模糊匹配)</td></tr>
</table>
</article>
<article class="api" id="fob-count">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/fob/count">/fob/count</code>
<span class="name">项目邮件统计</span>
</div>
<table>
<tr><th style="width:170px">参数</th><th style="width:110px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>emails</code></td><td>string/array</td><td class="req">是</td><td>邮箱地址</td></tr>
<tr><td><code>postid</code></td><td>int</td><td class="req">是</td><td>项目 id</td></tr>
<tr><td><code>udate</code></td><td>array</td><td class="opt">否</td><td>时间范围,2 个元素</td></tr>
<tr><td><code>show_count_filed</code></td><td>array</td><td class="opt">否</td><td>需要统计的字段,默认全部:<code>inbox,send,unseen,flagged,junk,hot_inbox,hot_send</code>,可加 <code>replied</code></td></tr>
</table>
<pre>{"inbox":320,"replied":320,"send":210,"unseen":5,"flagged":8,"junk":2,"hot_inbox":30,"hot_send":18}</pre>
</article>
<article class="api" id="fob-es">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/fob/es/lists /fob/es/count /fob/es/lists2 /fob/es/count2">/fob/es/lists /fob/es/count /fob/es/lists2 /fob/es/count2</code>
<span class="name">ES 版本的项目列表 / 统计</span>
</div>
<table>
<tr><th style="width:170px">接口</th><th style="width:150px">使用的索引</th><th>说明</th></tr>
<tr><td><code>/fob/es/lists</code>、<code>/fob/es/count</code></td><td><code>email_lists_all</code></td><td>全量索引版本,参数与 <code>/fob/lists</code> 基本一致</td></tr>
<tr><td><code>/fob/es/lists2</code>、<code>/fob/es/count2</code></td><td><code>email_lists_branch_{postid}</code></td><td>项目分支索引版本,参数与 <code>/fob/lists</code>、<code>/fob/count</code> 一致</td></tr>
</table>
<p class="tip">新接入请使用带 <code>2</code> 的版本(分支索引),数据隔离更干净。</p>
</article>
<article class="api" id="fob-search">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/fob/ai/search">/fob/ai/search</code>
<span class="name">AI 邮件搜索</span>
</div>
<p class="desc">按项目、发件人、时间查询最近 10 封收件箱 ai 邮件,用于自动化流程判断是否已收到回信。</p>
<table>
<tr><th style="width:130px">参数</th><th style="width:110px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>postid</code></td><td>int</td><td class="req">是</td><td>项目 id</td></tr>
<tr><td><code>email</code></td><td>string</td><td class="req">是</td><td>发件人邮箱</td></tr>
<tr><td><code>udate</code></td><td>int/string</td><td class="req">是</td><td>起始时间,时间戳或日期字符串</td></tr>
</table>
<pre>[{"uuid":123,"subject":"Re: 合作","udate":1761200000,"from":{"email":"a@b.com"}}]</pre>
</article>
<article class="api" id="fob-reply-count">
<div class="head">
<span class="m post">POST</span>
<code class="path" data-path="/ai-temp-reply-count">/ai-temp-reply-count</code>
<span class="name">模板回复数量统计</span>
</div>
<p class="desc">统计收件箱中标题以指定模板结尾的邮件数量(最多扫描 5000 封)。</p>
<table>
<tr><th style="width:130px">参数</th><th style="width:110px">类型</th><th style="width:60px">必填</th><th>说明</th></tr>
<tr><td><code>postid</code></td><td>int</td><td class="req">是</td><td>项目 id,缺失直接返回空数组</td></tr>
<tr><td><code>subjects</code></td><td>array</td><td class="req">是</td><td>标题后缀列表</td></tr>
</table>
<pre>{"count": 37}</pre>
</article>
<div class="empty hide" id="empty">没有匹配的接口</div>
</main>
</div>
<script>
(function () {
var q = document.getElementById('q');
var items = [].slice.call(document.querySelectorAll('.api, .card'));
var navs = [].slice.call(document.querySelectorAll('.side a'));
var heads = [].slice.call(document.querySelectorAll('.side h4'));
var empty = document.getElementById('empty');
// 搜索过滤
q.addEventListener('input', function () {
var kw = this.value.trim().toLowerCase();
var show = 0;
items.forEach(function (el) {
var hit = !kw || el.textContent.toLowerCase().indexOf(kw) > -1;
el.classList.toggle('hide', !hit);
if (hit) show++;
});
navs.forEach(function (a) {
var id = a.getAttribute('href').slice(1);
var target = document.getElementById(id);
a.classList.toggle('hide', !!(kw && target && target.classList.contains('hide')));
});
heads.forEach(function (h) {
var next = h.nextElementSibling, has = false;
while (next && next.tagName === 'A') {
if (!next.classList.contains('hide')) has = true;
next = next.nextElementSibling;
}
h.classList.toggle('hide', !has);
});
empty.classList.toggle('hide', show > 0);
});
// 点击路径复制
[].slice.call(document.querySelectorAll('.path')).forEach(function (el) {
el.addEventListener('click', function () {
var text = el.getAttribute('data-path') || el.textContent;
var ta = document.createElement('textarea');
ta.value = text.split(' ')[0];
document.body.appendChild(ta);
ta.select();
try { document.execCommand('copy'); } catch (e) {}
document.body.removeChild(ta);
var old = el.textContent;
el.textContent = '已复制';
setTimeout(function () { el.textContent = old; }, 900);
});
});
// 侧边栏高亮
var links = {};
navs.forEach(function (a) { links[a.getAttribute('href').slice(1)] = a; });
var io = new IntersectionObserver(function (entries) {
entries.forEach(function (e) {
if (!e.isIntersecting) return;
navs.forEach(function (a) { a.classList.remove('on'); });
var a = links[e.target.id];
if (a) a.classList.add('on');
});
}, {rootMargin: '-70px 0px -75% 0px'});
items.forEach(function (el) { io.observe(el); });
})();
</script>
</body>
</html>