Creating an Email Mailbox on a VPS Server
How to Create an Email Mailbox on a VPS
🔹 Why You Need Email on a VPS
A mail server on your VPS allows you to create corporate email addresses (like info@yourdomain.com), send notifications from websites, or handle system messages.
You can set it up via a control panel (e.g., ISPmanager, cPanel, or Plesk) or manually via Linux.
🧭 Option 1. Using a Control Panel
✅ If you have ISPmanager, cPanel, or Plesk
- Log in to your control panel.
- Go to Mail → Mailboxes.
- Click Create mailbox.
- Fill in:
- Domain name (e.g., yourdomain.com)
- Mailbox name (e.g., info)
- Password
- Domain name (e.g., yourdomain.com)
- Click Save.
You can now access your mailbox via a mail client (Thunderbird, Outlook) or webmail (Roundcube, RainLoop).
🧠 Option 2. Without a Control Panel (Manual Setup on Linux)
1. Install Mail Server Software
A common combination for Linux is Postfix + Dovecot:
apt install postfix dovecot-imapd dovecot-pop3d -y
During setup:
- Choose Internet Site
- Enter your domain (e.g., yourdomain.com)
2. Create a Mail User
adduser mailuser
passwd mailuser
3. Configure Postfix
Edit /etc/postfix/main.cf:
myhostname = mail.yourdomain.com
mydestination = $myhostname, localhost.$mydomain, localhost, yourdomain.com
Restart services:
systemctl restart postfix dovecot
🔧 DNS Configuration for Proper Mail Delivery
Make sure your domain DNS records are configured correctly:
| Type | Example | Purpose |
| MX | mail.yourdomain.com | Main mail server |
| A | mail.yourdomain.com → VPS IP | Server IP |
| SPF | v=spf1 mx ~all | Sender verification |
| DKIM | (generated by mail server) | Message signing |
| DMARC | v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com | Reporting and authentication |
⚠️ Without SPF, DKIM, and DMARC records, your messages may end up in spam.
📬 Testing Email Functionality
- Open your webmail client (for example, Roundcube at https://mail.yourdomain.com/roundcube).
- Log in with the created credentials.
- Send a test email to an external address (like Gmail) to ensure delivery.
🧩 Recommendations
- Use an SSL certificate for secure connections (ports 465/587 for SMTP, 993 for IMAP).
- Avoid sending emails from the same IP that hosts high-traffic websites.
- Regularly scan your server for malware.
- For large-scale or business-critical mail, consider third-party services like Google Workspace or Zoho Mail.