GitHub - toinbox/simplerelay: SimpleRelay - Self-hosted SMTP relay with web dashboard, DNS validation, and per-sender access control (FastAPI/Postfix/Docker) · GitHub
/" data-turbo-transient="true" />
Skip to content
Search or jump to...
Search code, repositories, users, issues, pull requests...
-->
Search
Clear
Search syntax tips
Provide feedback
--><br>We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
Saved searches
Use saved searches to filter your results more quickly
-->
Name
Query
To see all available qualifiers, see our documentation.
Cancel
Create saved search
Sign in
/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
toinbox
simplerelay
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star
main
BranchesTags
Go to file
CodeOpen more actions menu
Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit
History<br>9 Commits<br>9 Commits
backend
backend
frontend
frontend
postfix
postfix
scripts
scripts
Dockerfile
Dockerfile
README.md
README.md
docker-compose.yml
docker-compose.yml
env.example
env.example
simplerelay.png
simplerelay.png
View all files
Repository files navigation
SimpleRelay
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.
Demo
Try it at relay.mailtoinbox.vip - register a free account and test the full system.
Configuration (.env)
Required
Variable<br>Description<br>Example
RELAY_ADMIN_EMAIL<br>Admin login email (created on first start)<br>admin@example.com
RELAY_ADMIN_PASSWORD<br>Admin password<br>strongpassword
RELAY_SECRET_KEY<br>JWT secret, generate with python3 -c "import secrets; print(secrets.token_urlsafe(32))"<br>x7f...
RELAY_HOSTNAME<br>Public hostname of this server (used in EHLO, shown in UI)<br>relay.example.com
RELAY_PUBLIC_IP<br>Server public IP (for SPF/PTR guidance)<br>203.0.113.10
RELAY_BASE_URL<br>Full URL of the web dashboard (for verification email links)<br>https://relay.example.com:8080
Database (PostgreSQL)
Default values work out of the box. Change passwords for production.
Variable<br>Default
POSTGRES_USER<br>simplerelay
POSTGRES_PASSWORD<br>simplerelay
POSTGRES_DB<br>simplerelay
RELAY_DATABASE_URL<br>postgresql://simplerelay:simplerelay@db:5432/simplerelay
System SMTP (optional)
Used for sending verification and password reset emails to users. If left empty, these emails are logged to console only (dev mode).
Variable<br>Description<br>Example
RELAY_SMTP_HOST<br>SMTP server<br>smtp.gmail.com
RELAY_SMTP_PORT<br>Port<br>587
RELAY_SMTP_USER<br>Username<br>noreply@example.com
RELAY_SMTP_PASSWORD<br>Password
RELAY_SMTP_FROM<br>From address<br>noreply@example.com
RELAY_SMTP_TLS<br>Use STARTTLS<br>true
Ports
Port<br>Service
8080<br>Web dashboard
2525<br>SMTP relay (your apps connect here)
Remap in docker-compose.yml if needed.
Quick Start
git clone https://github.com/toinbox/simplerelay.git<br>cd simplerelay<br>cp env.example .env<br>nano .env<br>docker compose up --build -d
Dashboard: http://your-server:8080<br>SMTP relay endpoint: your-server:2525
User Panel
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 Panel
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,...