From 9d84eb0634ac3adecf6970e683d21a3a84fc691a Mon Sep 17 00:00:00 2001 From: Dream Hunter Date: Sun, 5 May 2024 17:45:02 +0800 Subject: [PATCH] feat: update docs (#204) * feat: update docs * feat: update docs --- vitepress-docs/docs/.vitepress/zh.ts | 1 + .../docs/zh/guide/feature/mail-api.md | 18 ++++++++++++++++++ .../docs/zh/guide/feature/send-mail-api.md | 4 ++-- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 vitepress-docs/docs/zh/guide/feature/mail-api.md diff --git a/vitepress-docs/docs/.vitepress/zh.ts b/vitepress-docs/docs/.vitepress/zh.ts index 433ce4e6..9af20ee5 100644 --- a/vitepress-docs/docs/.vitepress/zh.ts +++ b/vitepress-docs/docs/.vitepress/zh.ts @@ -132,6 +132,7 @@ function sidebarGuide(): DefaultTheme.SidebarItem[] { items: [ { text: '配置 SMTP 代理服务', link: 'feature/config-smtp-proxy' }, { text: '发送邮件 API', link: 'feature/send-mail-api' }, + { text: '查看邮件 API', link: 'feature/mail-api' }, { text: '配置子域名邮箱', link: 'feature/subdomain' }, ] }, diff --git a/vitepress-docs/docs/zh/guide/feature/mail-api.md b/vitepress-docs/docs/zh/guide/feature/mail-api.md new file mode 100644 index 00000000..96dbdfaa --- /dev/null +++ b/vitepress-docs/docs/zh/guide/feature/mail-api.md @@ -0,0 +1,18 @@ +# 查看邮件 API + +## 通过 HTTP API 查看邮件 + +这是一个 `python` 的例子,使用 `requests` 库查看邮件。 + +```python +limit = 10 +offset = 0 +res = requests.post( + f"http://localhost:8787/api/mails?limit={limit}&offset={offset}`;", + json=send_body, headers={ + "Authorization": f"Bearer {你的JWT密码}", + # "x-custom-auth": "<你的网站密码>", # 如果启用了自定义密码 + "Content-Type": "application/json" + } +) +``` diff --git a/vitepress-docs/docs/zh/guide/feature/send-mail-api.md b/vitepress-docs/docs/zh/guide/feature/send-mail-api.md index 62174530..befb9ce5 100644 --- a/vitepress-docs/docs/zh/guide/feature/send-mail-api.md +++ b/vitepress-docs/docs/zh/guide/feature/send-mail-api.md @@ -18,14 +18,14 @@ res = requests.post( "http://localhost:8787/api/send_mail", json=send_body, headers={ "Authorization": f"Bearer {你的JWT密码}", - "x-custom-auth": "<你的网站密码>", + # "x-custom-auth": "<你的网站密码>", # 如果启用了自定义密码 "Content-Type": "application/json" } ) # 使用 body 验证 send_body = { - "token": "<你的JWT密码> + "token": "<你的JWT密码>", "from_name": "发件人名字", "to_name": "收件人名字", "to_mail": "收件人地址",