For AI agents: the complete documentation index is available at https://www.tteam.icu/zh/llms.txt, the full documentation bundle is available at https://www.tteam.icu/zh/llms-full.txt, and this page is available as Markdown at https://www.tteam.icu/zh/ops/linux/%E9%82%AE%E4%BB%B6%E6%9C%8D%E5%8A%A1.md.

邮件服务

AI 总结AI 生成

核心内容:介绍使用 mail-provider 服务发送邮件通知的方法,支持 SMTP 协议。

内容要点:

  • mail-provider 的部署与 SMTP 配置
  • 邮件发送接口和参数说明
  • 在告警、脚本和自动化任务中复用邮件通知

内容偏向可直接复用的运维操作,涵盖命令、配置顺序和部署注意事项。

setup.sh
docker rm -f mail-provider

docker run -d \
--name mail-provider \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \
--restart=always \
-p 4000:4000 \
-v $(pwd)/config/cfg.json:/app/cfg.json \
registry.cn-hangzhou.aliyuncs.com/buyfakett/mail-provider

其中 password 填写 SMTP 的秘钥。

cfg.json
{
  "debug": true,
  "http": {
    "listen": "0.0.0.0:4000",
    "token": ""
  },
  "smtp": {
    "addr": "smtp.qq.com:587",
    "username": "[email protected]",
    "password": "smtp",
    "from": "[email protected]"
  }
}

发送邮件示例:

curl http://127.0.0.1:4000/sender/mail -d "[email protected]&subject=svn备份通知&content=111"