带有网页控制面板的 SMTP 中继
SMTP Relay with Web Dashboard

原始链接: https://github.com/toinbox/simplerelay

**SimpleRelay** 是一款自托管的多租户 SMTP 中继解决方案,旨在通过多个上游提供商集中处理出站邮件路由。该方案基于 FastAPI、Postfix、PostgreSQL 和 Docker 构建,用户可通过统一的 Web 面板管理各种 SMTP 账户(如 Gmail、SendGrid、Amazon SES)。 **主要功能:** * **智能路由:** 根据发件人地址自动路由邮件,并支持各服务商的健康监测及 DNS 验证(SPF/DKIM/DMARC)。 * **强大的管理能力:** 提供安装向导、可搜索的邮件日志,以及全面的管理员控制功能,包括用户管理、代理分配(SOCKS5/HTTP)和全局发送限额。 * **安全性:** 通过强制 IP 白名单实施严格的访问控制,防止开放中继滥用。 * **易用性:** 适用于家庭实验室或企业环境,无需在每台设备上逐一配置 SMTP 凭据。所有服务均可指向同一个本地中继实例。 SimpleRelay 是开源软件(MIT 许可证),可通过 Docker Compose 快速部署。用户可以在 `relay.mailtoinbox.vip` 测试完整功能,或将其本地部署,从而简化服务器、摄像头及监控工具的邮件管理。

Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 带网页仪表盘的 SMTP 中继 (github.com/toinbox) 4 分,由 toinbox 发布于 1 小时前 | 隐藏 | 过往 | 收藏 | 1 条评论 帮助 ale42 0 分钟前 | 下一条 [-] 与通过 apt-get 安装像 procmail 或 exim 这样成熟的邮件服务器,并将其配置为本地局域网中继相比,这个工具带来了什么优势? 回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 加入 YC | 联系 搜索:
相关文章

原文

Self-hosted multi-tenant SMTP relay with web dashboard. Routes outbound email through multiple upstream SMTP providers based on sender address. Built with FastAPI, Postfix, PostgreSQL, Docker.

SimpleRelay Dashboard

Try it at relay.mailtoinbox.vip - register a free account and test the full system.

Variable Description Example
RELAY_ADMIN_EMAIL Admin login email (created on first start) [email protected]
RELAY_ADMIN_PASSWORD Admin password strongpassword
RELAY_SECRET_KEY JWT secret, generate with python3 -c "import secrets; print(secrets.token_urlsafe(32))" x7f...
RELAY_HOSTNAME Public hostname of this server (used in EHLO, shown in UI) relay.example.com
RELAY_PUBLIC_IP Server public IP (for SPF/PTR guidance) 203.0.113.10
RELAY_BASE_URL Full URL of the web dashboard (for verification email links) https://relay.example.com:8080

Default values work out of the box. Change passwords for production.

Variable Default
POSTGRES_USER simplerelay
POSTGRES_PASSWORD simplerelay
POSTGRES_DB simplerelay
RELAY_DATABASE_URL postgresql://simplerelay:simplerelay@db:5432/simplerelay

Used for sending verification and password reset emails to users. If left empty, these emails are logged to console only (dev mode).

Variable Description Example
RELAY_SMTP_HOST SMTP server smtp.gmail.com
RELAY_SMTP_PORT Port 587
RELAY_SMTP_USER Username [email protected]
RELAY_SMTP_PASSWORD Password
RELAY_SMTP_FROM From address [email protected]
RELAY_SMTP_TLS Use STARTTLS true
Port Service
8080 Web dashboard
2525 SMTP relay (your apps connect here)

Remap in docker-compose.yml if needed.

git clone https://github.com/toinbox/simplerelay.git
cd simplerelay
cp env.example .env
nano .env
docker compose up --build -d

Dashboard: http://your-server:8080 SMTP relay endpoint: your-server:2525

Every registered user gets access to:

Dashboard - overview of today's sent count, errors, provider health status with response times, and recent mail log entries.

Setup Wizard - guided first-time setup: enter email, auto-detect provider and SMTP settings, test connection, run DNS check (SPF/DKIM/DMARC), configure access control (IP whitelist, optionally SMTP AUTH), send test email.

Providers - manage SMTP providers (upstream accounts used for sending). Each provider has:

  • Auto-detection of SMTP settings from email address (Gmail, Outlook, Yahoo, Seznam, Zoho, SES, SendGrid, Mailgun, or custom SMTP)
  • App password guidance for providers that require it (Gmail, Outlook, Yahoo) with direct links
  • SMTP connection test
  • DNS validation (SPF, DKIM, DMARC) with provider-aware DKIM selector scanning
  • Send test email through the relay
  • Daily sending limit with usage counter
  • Per-provider access control (required) - IP whitelist is mandatory for the relay to accept connections. SMTP AUTH credentials can be added as additional authentication. Supports password generation, show/hide toggle, and regeneration.

Mail Logs - searchable log of all sent, failed, and bounced messages with sender, recipient, subject, status, client IP, and timestamp.

Admin users see additional sections:

User Management - list all registered users, activate/deactivate accounts (deactivation auto-suspends all user's relays), change user roles (user/admin), set maximum number of relays per user, set relay expiry period (auto-expire after N days), delete users with cascade.

Proxy Management - manage outbound IPs and SOCKS5/HTTP proxies. Each proxy entry has:

  • Protocol selection (direct IP, SOCKS5, HTTP)
  • Provider type filtering (assign specific proxies to specific provider types, e.g. Gmail proxies vs. catch-all)
  • Round-robin assignment with load tracking
  • Proxy testing (HTTP connectivity + SMTP handshake through proxy)
  • Enable/disable toggle

Provider Type Limits - set global daily sending limits per provider type (Gmail, Outlook, Seznam, custom, etc.) applied across all users.

Admin Dashboard - global stats: total/active users, total/active/locked relays, total/active proxies, sent and errors today.

Provider Oversight - view any user's relay list, lock/unlock individual providers with reason.

  • Postfix-based relay with per-sender routing to correct upstream SMTP
  • Built-in policy server (access control) - every provider requires a whitelisted IP address. Without it, the relay rejects all connections. SMTP AUTH credentials are optional as additional layer. No open relay possible.
  • Automatic provider detection from email address (MX/DNS lookup fallback for unknown domains)
  • User registration with email verification, password reset, password change
  • JWT authentication with httponly cookies
  • Relay expiry - providers auto-expire after admin-configured number of days
  • Health monitoring - periodic SMTP connection checks with status tracking
  • Multilingual UI - English, Czech, German, Russian, Spanish with runtime language switching
  • Single Docker Compose deployment (Postfix + PostgreSQL + FastAPI + React/Vite)

Home Network / Homelab Use Case

SimpleRelay works great as a central SMTP relay on your home network. Instead of configuring Gmail credentials in every device separately, you point everything at SimpleRelay on your LAN and manage credentials in one place.

Your home network (192.168.1.x)
┌─────────────────────────────────────────────────────────┐
│                                                         │
│  Proxmox ──────┐                                        │
│  Synology NAS ─┤                                        │
│  pfSense ──────┤    SimpleRelay          Gmail/Outlook   │
│  Grafana ──────┼──► 192.168.1.50:2525 ──► SMTP ──► ✉️  │
│  Uptime Kuma ──┤    (no auth needed)     (app password)  │
│  Home Asst. ───┤                                        │
│  Cameras ──────┘                                        │
│                                                         │
└─────────────────────────────────────────────────────────┘
  No NAT. No port forwarding. No public IP needed.
  • 10 devices = 10 places to maintain Gmail app passwords. With SimpleRelay: one.
  • No need for public IP, port forwarding, or your own mail server.
  • Add 0.0.0.0/0 as allowed subnet and every device on your network can send.

See COMPATIBILITY.md for the full list of 50+ compatible devices with setup instructions - servers, firewalls, cameras, monitoring tools, backup software, UPS, printers and more.

FastAPI (Python 3.12), Postfix, PostgreSQL 16, React + Vite, Docker Compose

MIT

联系我们 contact @ memedata.com