This guide covers essential configuration for self-hosted Mailtrain installations.
Mailtrain uses MySQL/MariaDB for main data and MongoDB for logs. Configure in server/config/default.toml:
[mysql]
host = "localhost"
port = 3306
user = "mailtrain"
password = "your-secure-password"
database = "mailtrain"
[mongodb]
host = "localhost"
port = 27017
database = "mailtrain"
[redis]
host = "localhost"
port = 6379
Configure in server/config/default.toml:
[app]
protocol = "http"
host = "localhost"
port = 8080
secret = "generate-a-random-secret-key"
[security]
forceSecureConnection = false # Set to true with HTTPS
Configure SMTP in server/config/default.toml:
[[smtpConnections]]
name = "Default SMTP"
host = "smtp.yourprovider.com"
port = 587
secure = false
auth =
user = "your-smtp-user"
pass = "your-smtp-password"
default = true
pool = true
maxConnections = 5
Recommended SMTP Providers:
Mailtrain includes Zone-MTA for direct email delivery:
[zoneMta]
enabled = true
host = "localhost"
port = 2525
Configure DNS records for direct sending:
v=spf1 ip4:YOUR.SERVER.IP ~allConfigure user roles in Account Settings > Users:
Configure list settings in Lists > [List Name] > Settings:
Mailtrain supports HTML and MJML templates:
Configure webhooks for integrations:
[webhooks]
subscribe = "https://your-app.com/webhook/subscribe"
unsubscribe = "https://your-app.com/webhook/unsubscribe"
bounce = "https://your-app.com/webhook/bounce"
complaint = "https://your-app.com/webhook/complaint"
docker logs mailtrainsystemctl status mongod