mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-07-07 23:31:38 +08:00
feat: telegram bot (#238)
This commit is contained in:
@@ -95,6 +95,8 @@ ENABLE_AUTO_REPLY = false
|
||||
# dkim config
|
||||
# DKIM_SELECTOR = "mailchannels" # Refer to the DKIM section mailchannels._domainkey for mailchannels
|
||||
# DKIM_PRIVATE_KEY = "" # Refer to the contents of priv_key.txt in the DKIM section
|
||||
# telegram bot
|
||||
# TG_MAX_ACCOUNTS = 5
|
||||
|
||||
[[d1_databases]]
|
||||
binding = "DB"
|
||||
|
||||
@@ -12,6 +12,7 @@ cp wrangler.toml.template wrangler.toml
|
||||
|
||||
> [!NOTE]
|
||||
> 如果你要启用注册用户功能,并需要发送邮件验证,则需要创建 `KV` 缓存, 不需要可跳过此步骤
|
||||
> 如果需要 Telegram Bot,需要创建 `KV` 缓存,不需要可跳过此步骤
|
||||
|
||||
通过命令行创建 KV 缓存,或者在 Cloudflare 控制台创建,然后复制对应配置到 `wrangler.toml` 文件中
|
||||
|
||||
@@ -62,6 +63,8 @@ ENABLE_AUTO_REPLY = false
|
||||
# dkim config
|
||||
# DKIM_SELECTOR = "mailchannels" # 参考 DKIM 部分 mailchannels._domainkey 的 mailchannels
|
||||
# DKIM_PRIVATE_KEY = "" # 参考 DKIM 部分 priv_key.txt 的内容
|
||||
# telegram bot 最多绑定邮箱数量
|
||||
# TG_MAX_ACCOUNTS = 5
|
||||
|
||||
# D1 数据库的名称和 ID 可以在 cloudflare 控制台查看
|
||||
[[d1_databases]]
|
||||
@@ -83,6 +86,17 @@ database_id = "xxx" # D1 数据库 ID
|
||||
# simple = { limit = 10, period = 60 }
|
||||
```
|
||||
|
||||
## Telegram Bot 配置
|
||||
|
||||
> [!NOTE]
|
||||
> 如果不需要 Telegram Bot, 可跳过此步骤
|
||||
|
||||
请先创建一个 Telegram Bot,然后获取 `token`,然后执行下面的命令,将 `token` 添加到 secrets 中
|
||||
|
||||
```bash
|
||||
pnpm wrangler secret put TELEGRAM_BOT_TOKEN
|
||||
```
|
||||
|
||||
## 部署
|
||||
|
||||
第一次部署会提示创建项目, `production` 分支请填写 `production`
|
||||
|
||||
@@ -28,6 +28,8 @@ docker-compose up -d
|
||||
|
||||
修改 docker-compose.yaml 中的环境变量, 注意选择合适的 `tag`
|
||||
|
||||
`proxy_url` 为 `worker` 的 URL 地址
|
||||
|
||||
```yaml
|
||||
services:
|
||||
smtp_proxy_server:
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
```python
|
||||
limit = 10
|
||||
offset = 0
|
||||
res = requests.post(
|
||||
res = requests.get(
|
||||
f"http://localhost:8787/api/mails?limit={limit}&offset={offset}`;",
|
||||
json=send_body, headers={
|
||||
headers={
|
||||
"Authorization": f"Bearer {你的JWT密码}",
|
||||
# "x-custom-auth": "<你的网站密码>", # 如果启用了自定义密码
|
||||
"Content-Type": "application/json"
|
||||
|
||||
@@ -45,3 +45,10 @@
|
||||
|
||||

|
||||

|
||||
|
||||
9. Telegram Bot 配置
|
||||
|
||||
> [!NOTE]
|
||||
> 如果不需要 Telegram Bot, 可跳过此步骤
|
||||
|
||||
请先创建一个 Telegram Bot,然后获取 `token`,然后执行下面的命令,将 `token` 添加到 `Variables` 中, Name: `TELEGRAM_BOT_TOKEN`
|
||||
|
||||
Reference in New Issue
Block a user