How to Set Up a Mailbox on Your VPS
Сreating an email on a VPS server
🔹 Why You Need Email on Your Own Server
A mail service on a VPS allows you to use professional email addresses such as info@yourdomain.com, send system notifications, or deliver emails directly from your website without third-party services.
You can configure it through a control panel (ISPmanager, cPanel, Plesk) or manually in Linux.
🧭 Option 1. Using a Control Panel
✅ If your server runs ISPmanager, cPanel, or Plesk, follow these steps:
- Log in to the control panel.
- Go to Mail → Mailboxes.
- Click Create mailbox.
- Fill in the following fields:
- Domain name — your domain (e.g., yourdomain.com)
- Mailbox name — for example, info
- Password — set a strong password
- Domain name — your domain (e.g., yourdomain.com)
- Click Save.
Your mailbox is now created. You can connect it to an email client (Thunderbird, Outlook) or access it via webmail (Roundcube, RainLoop).
🧠 Option 2. Manual Setup in Linux
- Install the Mail Server
A common combination for Linux is Postfix + Dovecot:
apt install postfix dovecot-imapd dovecot-pop3d -y
During installation:
- Choose Internet Site as the configuration type.
- Enter your domain (e.g., yourdomain.com).
- Create a Mail User
adduser mailuser
passwd mailuser
- Configure Postfix
Edit the file /etc/postfix/main.cf:
myhostname = mail.yourdomain.com
mydestination = $myhostname, localhost.$mydomain, localhost, yourdomain.com
Save the changes and restart the services:
systemctl restart postfix dovecot
🔧 DNS Settings for Proper Mail Delivery
| Type | Example | Purpose |
|---|---|---|
| MX | mail.yourdomain.com | Primary mail server |
| A | mail.yourdomain.com → IP VPS | Server IP address |
| SPF | v=spf1 mx ~all | Protects against sender spoofing |
| DKIM | (generated by the mail server) | Adds signature to outgoing mail |
| DMARC | v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com | Collects email delivery reports |
⚠️ Without proper SPF, DKIM, and DMARC setup, your messages may end up in the spam folder.
📬 Testing Your Mail Server
After creating the mailbox, open your webmail client (for example, Roundcube — usually available at https://mail.yourdomain.com/roundcube).
Log in with your new credentials, send a test email to an external address (e.g., Gmail), and verify that the message is delivered successfully.
🧩 Recommendations
- Use an SSL certificate for encrypted connections (SMTP ports 465/587, IMAP port 993).
- Avoid sending mail from the same IP that hosts websites or scripts prone to spam.
- Regularly scan your server for viruses.
- For large-scale email needs, consider professional platforms such as Google Workspace or Zoho Mail.