Files
cloudflare_temp_email/vitepress-docs/docs/zh/guide/feature/new-address-api.md
2024-06-12 13:53:40 +08:00

589 B

新建邮箱地址 API

通过 admin API 新建邮箱地址

这是一个 python 的例子,使用 requests 库发送邮件。

res = requests.post(
    # 替换 xxxx.xxxx 为你的 worker 域名
    "https://xxxx.xxxx/admin/new_address",
    json={
        # 是否启用前缀 (True/False)
        "enablePrefix": True,
        "name": "<邮箱名称>",
        "domain": "<邮箱域名>",
    },
    headers={
        'x-admin-auth': "<你的网站admin密码>",
        "Content-Type": "application/json"
    }
)

# 返回值 {"jwt": "<Jwt>"}
print(res.json())