Creating an Email Mailbox on a VPS Server

🔹 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

  1. Log in to your control panel.
  2. Go to Mail → Mailboxes.
  3. Click Create mailbox.
  4. Fill in:
    • Domain name (e.g., yourdomain.com)
    • Mailbox name (e.g., info)
    • Password
  5. 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:

TypeExamplePurpose
MXmail.yourdomain.comMain mail server
Amail.yourdomain.com → VPS IPServer IP
SPFv=spf1 mx ~allSender verification
DKIM(generated by mail server)Message signing
DMARCv=DMARC1; p=none; rua=mailto:dmarc@yourdomain.comReporting and authentication

⚠️ Without SPF, DKIM, and DMARC records, your messages may end up in spam.

📬 Testing Email Functionality

  1. Open your webmail client (for example, Roundcube at https://mail.yourdomain.com/roundcube).
  2. Log in with the created credentials.
  3. 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.