Setting up a VPS for email sending requires careful configuration. Skip a step and you'll end up in spam folders or get your IP blocked. Here's the complete checklist.
Choosing Your VPS
For email sending, you need:
- Clean IP — not previously blacklisted
- Port 25 open — some providers block it by default
- PTR record support — you must be able to set reverse DNS
- At least 2GB RAM — for the SMTP server and queue management
- SSD storage — for fast queue processing
Step 1: OS Setup
Use Ubuntu 22.04 or 24.04 LTS:
apt update && apt upgrade -ychr(10)apt install curl wget nano ufw fail2ban -yStep 2: Set Hostname
Your hostname should match your sending domain:
hostnamectl set-hostname mail.yourdomain.comEdit /etc/hosts to include both 127.0.0.1 and your server IP mapped to the hostname.
Step 3: PTR Record
Set the PTR (reverse DNS) record through your VPS provider's control panel:
YOUR_IP → mail.yourdomain.comMany mail servers reject email from IPs without matching PTR records.
Step 4: Firewall
sudo ufw default deny incomingchr(10)sudo ufw default allow outgoingchr(10)sudo ufw allow sshchr(10)sudo ufw allow 25/tcpchr(10)sudo ufw allow 80/tcpchr(10)sudo ufw allow 443/tcpchr(10)sudo ufw allow 587/tcpchr(10)sudo ufw allow 465/tcpchr(10)sudo ufw enableStep 5: Install Your SMTP Server
Choose and install your preferred SMTP software. Follow the vendor's installation documentation for your specific choice.
Step 6: DNS Records
Configure these for your sending domain:
- MX Record: Points to your mail server hostname
- SPF: Authorizes your IP to send
- DKIM: Digital signature key in DNS
- DMARC: Authentication policy
Step 7: Test Deliverability
Before sending real campaigns:
- Send test emails to Gmail, Yahoo, and Outlook
- Check headers for SPF/DKIM/DMARC pass
- Run smtpcheck.lexlabtools.com
- Test with mail-tester.com (aim for 9/10+)
Step 8: Security
- Disable open relay
- Enable TLS for all connections
- Set up rate limiting
- Monitor logs for unauthorized access