快速开始
- 一台能长期运行的服务器,装好 Docker 和 Docker Compose
- 一个域名和 HTTPS 反向代理(Caddy / Nginx 等);只在本机试用可以跳过
1. 下载配置
Section titled “1. 下载配置”mkdir damail && cd damailcurl -O https://raw.githubusercontent.com/gopkg-dev/damail/main/docker-compose.ymlcurl -o .env https://raw.githubusercontent.com/gopkg-dev/damail/main/.env.example编辑 .env,至少填好这几项:
# openssl rand -hex 32 生成MASTER_KEY=POSTGRES_PASSWORD=换成一个强密码PUBLIC_URL=https://mail.example.com# 通过 HTTPS 访问时设为 trueCOOKIE_SECURE=truedocker compose pull && docker compose up -d镜像来自 ghcr.io/gopkg-dev/damail(linux/amd64、linux/arm64)。数据库迁移在启动时自动执行。默认只监听 127.0.0.1:8787。
3. 配置反向代理
Section titled “3. 配置反向代理”把域名代理到 http://127.0.0.1:8787,并开启 HTTPS。反向代理必须关闭缓冲,否则实时刷新和 MCP 会卡住。
Caddy:
mail.example.com { reverse_proxy 127.0.0.1:8787 { flush_interval -1 }}Nginx:
location / { proxy_pass http://127.0.0.1:8787; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_buffering off; proxy_read_timeout 1h;}4. 开始使用
Section titled “4. 开始使用”- 打开
https://mail.example.com,第一次访问时创建管理员账号 - 在「设置 → 邮箱管理」添加邮箱,见接入邮箱
- 需要 AI 功能时,在「智能 → 模型配置」配置模型,见模型配置
- 给 Agent 用:在「设置 → API Key」创建 Key,见 MCP 接入
需要备份的是:PostgreSQL 数据卷(db-data)、DaMail 数据卷(app-data,原始邮件和附件)以及 .env。