Files
autoPlus/docs/mail.md
2026-01-26 15:04:02 +08:00

139 lines
3.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
````md
# Cloud Mail 开放 API - 接口文档
> 说明:部分请求参数支持模糊匹配,可传入 `%`
> 示例:`admin` 等值匹配;`admin%` 开头匹配;`%@example.com` 结尾匹配;`%admin%` 包含匹配。 :contentReference[oaicite:0]{index=0}
---
## 1) 生成 Token
用于生成确认身份的令牌,放入 `Authorization` 请求头使用。**全局只有一个**,重新生成会导致旧 Token 失效。 :contentReference[oaicite:1]{index=1}
- **接口地址**`POST /api/public/genToken` :contentReference[oaicite:2]{index=2}
### 请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---:|---|
| email | string | 是 | 管理员邮箱 |
| password | string | 是 | 邮箱密码 |
:contentReference[oaicite:3]{index=3}
### 返回示例
```json
{
"code": 200,
"message": "success",
"data": {
"token": "9f4e298e-7431-4c76-bc15-4931c3a73984"
}
}
````
([doc.skymail.ink][1])
---
## 2) 邮件查询
* **接口地址**`POST /api/public/emailList` ([doc.skymail.ink][1])
### 请求头
| Header | 必填 | 说明 |
| ------------- | -: | ---- |
| Authorization | 是 | 身份令牌 |
([doc.skymail.ink][1])
### 请求参数
> 说明:文档里 `sendEmail/subject` 的类型写成了 `sting`,这里按原文保留,你也可以在实现时按 `string` 处理。 ([doc.skymail.ink][1])
| 参数 | 类型 | 必填 | 默认值 | 说明 |
| --------- | ------- | -: | ---- | ------------------------ |
| toEmail | string | 否 | | 收件人邮箱,支持模糊 |
| sendName | string | 否 | | 发件人名字,支持模糊 |
| sendEmail | sting | 否 | | 发件人邮箱,支持模糊 |
| subject | sting | 否 | | 邮件主题,支持模糊 |
| content | string | 否 | | 邮件 html支持模糊 |
| timeSort | string | 否 | desc | 时间排序(`asc` 最旧,`desc` 最新) |
| type | integer | 否 | | 邮件类型(`0` 收件,`1` 发件,空=全部) |
| isDel | integer | 否 | | 是否删除(`0` 正常,`2` 删除,空=全部) |
| num | integer | 否 | 1 | 页码 |
| size | integer | 否 | 20 | 每页数量 |
([doc.skymail.ink][1])
### 返回示例
```json
{
"code": 200,
"message": "success",
"data": [
{
"emailId": 999,
"sendEmail": "admin@example.com",
"sendName": "hello",
"subject": "Hello word",
"toEmail": "admin@example.com",
"toName": "admin",
"createTime": "2099-12-30 23:99:99",
"type": 0,
"content": "<div>Hello word</div>",
"text": "Hello word",
"isDel": 0
}
]
}
```
> 注:`createTime` 为 **UTC 时间**。 ([doc.skymail.ink][1])
---
## 3) 添加用户
* **接口地址**`POST /api/public/addUser` ([doc.skymail.ink][1])
### 请求头
| Header | 必填 | 说明 |
| ------------- | -: | ---- |
| Authorization | 是 | 身份令牌 |
([doc.skymail.ink][1])
### 请求参数
| 参数 | 类型 | 必填 | 描述 |
| --------------- | ------------- | -: | ------------------ |
| list | array<object> | 是 | 用户数组 |
| list[].email | string | 是 | 邮箱地址 |
| list[].password | sting | 否 | 密码,不填自动生成 |
| list[].roleName | sting | 否 | 权限身份名,不填自动选择默认权限身份 |
([doc.skymail.ink][1])
### 返回示例
```json
{
"code": 200,
"message": "success",
"data": null
}
```
([doc.skymail.ink][1])
```
::contentReference[oaicite:14]{index=14}
```
[1]: https://doc.skymail.ink/api/api-doc.html "接口文档 | Cloud Mail"