ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

local-mail-server

本地邮件服务器系统,基于 Stalwart Mail Server + Brevo 中继 + VPS 中继。支持完整的邮件收发功能,适用于无公网 IP 环境。触发词:邮件服务器、email、imap、smtp、stalwart、brevo、vps relay。

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/franklili3/local-mail-server
Or

本地邮件服务器(无公网 IP 方案)

基于 Stalwart Mail Server 的本地邮件系统,配合 Brevo 发件中继和 VPS 收件中继,实现完整的邮件收发功能。

适用场景:家庭网络、运营商 NAT 环境、无公网 IP

架构概览

┌─────────────────────────────────────────────────────────────────┐
│                       本地服务器 (Mac/Linux)                      │
│                                                                 │
│   Webmail/IMAP客户端 ──IMAP──► Stalwart ──Brevo──► 外部收件人    │
│        │                           │                            │
│        └── 显示/管理邮件           └── 存储/转发邮件             │
└─────────────────────────────────────────────────────────────────┘
              ▲
              │ Tailscale VPN (私有网络 IP)
              │
┌─────────────┴───────────────────────────────────────────────────┐
│                        VPS (公网 IP)                             │
│                                                                 │
│   Postfix 中继 ──► DKIM 验证 ──► Tailscale ──► 本地服务器        │
│       ▲                                                         │
│       │                                                         │
│   外部邮件 (Gmail/QQ Mail 等)                                    │
└─────────────────────────────────────────────────────────────────┘

收件: 外部发件人 → DNS MX → VPS Postfix → Tailscale VPN → 本地 Stalwart
发件: Webmail → Stalwart (SMTP) → Brevo 中继 → 外部收件人

系统要求

本地服务器

  • macOS / Linux
  • Stalwart Mail Server 0.15.5+
  • Tailscale(用于 VPS 通信)

VPS

  • 任意云服务商(Vultr/DigitalOcean/腾讯云等)
  • Ubuntu 24.04 LTS
  • 公网 IP
  • 最小配置即可(1核 512MB 内存)

外部服务

  • Brevo 账户(免费 300 封/天)
  • Cloudflare DNS(管理域名)
  • Tailscale 账户(免费)

快速开始

1. 安装 Stalwart

# macOS ARM64
curl -L -o stalwart.tar.gz "https://github.com/stalwartlabs/stalwart/releases/download/v0.15.5/stalwart-aarch64-apple-darwin.tar.gz"

# Linux x86_64
curl -L -o stalwart.tar.gz "https://github.com/stalwartlabs/stalwart/releases/download/v0.15.5/stalwart-x86_64-unknown-linux-gnu.tar.gz"

tar -xzf stalwart.tar.gz
chmod +x stalwart
./stalwart -c config/config.toml

2. 配置 VPS 中继

# 在 VPS 上安装 Postfix 和 OpenDKIM
sudo apt update
sudo apt install -y postfix opendkim opendkim-tools

# 配置 Postfix 转发到本地服务器
echo "yourdomain.com    smtp:[LOCAL_TAILSCALE_IP]:25" | sudo tee /etc/postfix/transport
sudo postmap /etc/postfix/transport

3. 配置 DNS

在 Cloudflare DNS 添加:

类型    名称           内容
───────────────────────────────────────────────────────────
MX      @              mail.yourdomain.com (优先级 10)
A       mail           YOUR_VPS_IP (仅 DNS,灰色云朵)
TXT     @              v=spf1 ip4:YOUR_VPS_IP include:spf.brevo.com ~all
TXT     _dmarc         v=DMARC1; p=none; rua=mailto:[email protected]
TXT     mail._domainkey  DKIM 公钥

配置详解

Stalwart 配置 (config/config.toml)

# 服务器基本配置
server.hostname = "mail.yourdomain.com"
server.listener.smtp.bind = ["[::]:25"]
server.listener.imap.bind = ["[::]:143"]
server.listener.submission.bind = ["[::]:587"]

# Brevo 发件中继
[relay.brevo]
address = "smtp-relay.brevo.com"
port = 587
protocol = "smtp"

Metadata

Stars2387
Views0
Updated2026-03-09
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-franklili3-local-mail-server": {
      "enabled": true,
      "auto_update": true
    }
  }
}

Tags

#email#mail-server#stalwart#brevo#vps#relay#self-hosted
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.