Get your mail server running in 5 steps.
- Fresh Ubuntu 20.04/22.04 or Debian 11/12 server
- Minimum 2GB RAM, 10GB disk
- Static IP address
- Root/sudo access
- Domain name ready
Before installation, configure these DNS records:
Type Name Value TTL
────────────────────────────────────────────────────────────────────────────
A mail.yourdomain.com YOUR_SERVER_IP 3600
MX yourdomain.com mail.yourdomain.com (10) 3600
TXT yourdomain.com v=spf1 mx ~all 3600
TXT _dmarc.yourdomain.com v=DMARC1; p=quarantine; ... 3600
Important: Also configure PTR (Reverse DNS) with your hosting provider:
YOUR_SERVER_IP → mail.yourdomain.com
Wait 5-10 minutes for DNS propagation, then verify:
dig mail.yourdomain.com
dig MX yourdomain.com# Clone repository
git clone https://github.com/Fused-Gaming/Universal-Mailer.git
cd mail-server-template
# Copy environment template
cp .env.example .env
# Edit configuration
nano .envMinimum required changes in .env:
ORG_NAME="Your Company Name"
PRIMARY_DOMAIN="yourdomain.com"
MAIL_DOMAIN="mail.yourdomain.com"
ADMIN_EMAIL="admin@yourdomain.com"Save and exit (Ctrl+O, Enter, Ctrl+X)
# Make executable
chmod +x build.sh
# Run as root
sudo ./build.shThe script will:
- ✓ Verify system requirements
- ✓ Install all dependencies
- ✓ Configure mail services
- ✓ Setup SSL certificates
- ✓ Configure firewall
- ✓ Setup automated backups
After installation completes, get your DKIM public key:
sudo cat /etc/opendkim/keys/yourdomain.com/mail.txtAdd as DNS TXT record:
Name: mail._domainkey.yourdomain.com
Type: TXT
Value: [paste the entire content from mail.txt]
TTL: 3600
Verify DKIM after 5 minutes:
opendkim-testkey -d yourdomain.com -s mail -vvv- Access web interface: https://mail.yourdomain.com
- Login with credentials from installation report
- Navigate to: Domains → yourdomain.com → Mailboxes
- Click: "Add Mailbox"
- Create your first email account
Test your mail server setup:
- Can access https://mail.yourdomain.com
- Can login to admin panel
- DKIM test passes:
opendkim-testkey -d yourdomain.com -s mail -vvv - Services running:
systemctl status postfix dovecot nginx - Send test email to external address
- Receive test email from external address
- Check spam score: mail-tester.com
- Verify DNS: mxtoolbox.com
- Change admin password in web interface
- Configure email clients (Thunderbird, Outlook, etc.)
- Setup monitoring (optional)
- Configure mobile devices (optional)
- Review security settings
# Check Nginx status
sudo systemctl status nginx
# Check certificate
sudo certbot certificates
# Restart Nginx
sudo systemctl restart nginx- Verify SPF:
dig TXT yourdomain.com - Verify DKIM:
opendkim-testkey -d yourdomain.com -s mail -vvv - Verify DMARC:
dig TXT _dmarc.yourdomain.com - Test at: mail-tester.com
# Check Postfix
sudo systemctl status postfix
# Check Dovecot
sudo systemctl status dovecot
# View logs
sudo tail -f /var/log/mail.log
# Check mail queue
mailq- Server: mail.yourdomain.com
- Port: 993
- Security: SSL/TLS
- Username: yourname@yourdomain.com
- Password: [your mailbox password]
- Server: mail.yourdomain.com
- Port: 587
- Security: STARTTLS
- Username: yourname@yourdomain.com
- Password: [your mailbox password]
- Full documentation: README.md
- Configuration reference: .env.example
- Logs:
/var/log/mail-server-install.log - Installation info:
/root/yourdomain.com-MAIL-INFO.txt
Total setup time: ~45 minutes (including DNS propagation)