Language & currency
Currency

Gratis website & Server Migratie

Kolonel Server
VPS Email - Host Your Own Mail Server

Why Host Your Own Email Server?

Many businesses rely on third-party email platforms such as Gmail or Microsoft 365 for daily communication. While these services are convenient, they often come with recurring subscription costs, storage limitations, and reduced control over your data.

Running your own email server on a VPS allows you to maintain complete ownership of your email infrastructure while providing professional email addresses under your own domain.

Common reasons to self-host email include:

  • Lower long-term costs
  • Full administrative control
  • Improved privacy
  • Flexible mailbox storage
  • Aangepast beveiligingsbeleid
  • Professional branding
  • Support for multiple domains and users

What Is an Email Server?

An email server is responsible for sending, ontvangen, storing, and managing email messages.

When someone sends an email to your domain, several services work together to process the message:

  • SMTP handles outgoing mail delivery
  • IMAP allows users to access emails across devices
  • POP3 downloads messages locally
  • DNS records direct email traffic
  • Authentication systems verify legitimacy

A properly configured email server performs all of these tasks automatically.

Wordpress Hosting

WordPress-webhosting

Vanaf $ 3,99/maandelijks

Koop nu

Requirements Before You Start

Before deploying an email server, zorg ervoor dat je dat hebt gedaan:

Een VPS

Aanbevolen minimale specificaties:

Bron Minimum
CPU 1 vCPU
RAM 2 GB
Opslag 20 GB SSD
IP-adres Toegewijde IPv4
Besturingssysteem A supported OS for the selected mail stack; Mail-in-a-Box requires Ubuntu 22.04 x64

A Domain Name

You should own a domain such as:

yourdomain.com

Email accounts will use addresses such as:

[email protected]
[email protected]
[email protected]

Root-toegang

Administrative access is required to install and manage mail services.

Open Mail Ports

Confirm inbound and outbound TCP 25, a stable IP with configurable reverse DNS, and matching forward DNS. SMTP submission through a relay can help with outbound restrictions, but receiving internet mail still requires a reachable inbound mail server.

Cheap VPS

Goedkope VPS-server

Vanaf $ 2,99/maandelijks

Koop nu

Verify that your VPS provider allows mail traffic on port 25. Some providers block SMTP ports by default to reduce spam abuse.

Understanding Email Components

A complete email system consists of several services.

SMTP Server

Handles sending and receiving mail between servers.

Common software:

  • Postfix
  • Exim
  • Sendmail

Postfix is recommended due to its security and reliability.

IMAP and POP3 Server

Allows users to access their mailboxes.

Windows VPS

Windows VPS-hosting

Toegang op afstand en volledig beheer

Koop nu

Popular solution:

  • Dovecot

Webmail Interface

Provides browser-based email access.

Common options:

  • Roundcube
  • SnappyMail

Spambescherming

Filters unwanted messages before they reach users.

Popular tools:

  • SpamAssassin
  • Rspamd
  • ClamAV

DNS-configuratie

Correct DNS records are essential for successful email delivery.

A Record

Create a hostname for your mail server.

Voorbeeld:

mail.yourdomain.com → VPS_IP_ADDRESS

MX-record

Directs email traffic to your server.

Voorbeeld:

Priority: 10
Mail Server: mail.yourdomain.com

SPF Record

Specifies which servers may send mail for your domain.

Voorbeeld:

v=spf1 mx ip4:SERVER_IP -all

DKIM Record

Digitally signs outgoing messages to verify authenticity.

Voorbeeld:

default._domainkey.yourdomain.com

DMARC Record

Provides instructions for handling authentication failures.

Voorbeeld:

v=DMARC1; p=none; rua=mailto:[email protected]

Publish one valid SPF record, enable DKIM signing and monitor DMARC reports before moving from p=none to quarantine or reject. Authentication supports deliverability but does not guarantee inbox placement.

Option 1: Install Mail-in-a-Box

Use a fresh Ubuntu 22.04 x64 server dedicated to Mail-in-a-Box, as specified by its setup guide. Do not apply the manual Postfix, Dovecot, web-server or firewall instructions below to that managed installation; the box maintains its own configuration.

Mail-in-a-Box is one of the simplest ways to deploy a complete email server.

Kenmerken omvatten:

  • Postfix
  • Dovecot
  • Spamfiltering
  • Webmail
  • DNS management
  • SSL-certificaten
  • Automatische updates

Installatie

Update your server:

apt update && apt upgrade -y

Install Mail-in-a-Box:

curl -fsSLo mailinabox-setup.sh https://mailinabox.email/setup.sh
less mailinabox-setup.sh
sudo -E bash mailinabox-setup.sh

The installation wizard will guide you through:

  • Domeinconfiguratie
  • Administrator account creation
  • SSL setup
  • DNS recommendations

Voor de meeste gebruikers, this is the fastest route to a production-ready email server.

Option 2: Build a Manual Mail Server

The package commands below are an installation outline, not a complete production configuration. Before exposing mail service, configure Postfix relay restrictions and authenticated submission, Dovecot mailbox paths and authentication, TLS, DKIM signing and the spam-filter integration. Test that unauthenticated external clients cannot relay to other domains. Do not change MX records until sending, receiving and recovery tests pass.

Advanced users may prefer complete control.

Install Postfix

apt install postfix -y

Selecteer:

Internet Site

Set your hostname:

mail.yourdomain.com

Install Dovecot

apt install dovecot-core dovecot-imapd dovecot-pop3d -y

Enable mailbox access:

systemctl enable dovecot
systemctl start dovecot

Create Mail Users

Voorbeeld:

adduser john

Postbus:

[email protected]

Install Roundcube

apt install roundcube roundcube-core roundcube-mysql -y

Configure Apache or NGINX to serve the webmail interface.

Securing the Mail Server

Email servers are frequent attack targets.

Installeer SSL-certificaten

Use Let’s Encrypt:

apt install certbot -y

Generate a certificate:

certbot certonly --standalone -d mail.yourdomain.com

Certificate paths:

/etc/letsencrypt/live/mail.yourdomain.com/fullchain.pem
/etc/letsencrypt/live/mail.yourdomain.com/privkey.pem

Configure both Postfix and Dovecot to use these certificates.

Harden SSH Access

Disable password authentication:

PasswordAuthentication no

Verify key login and sudo access in a second session before disabling passwords.

Installeer Fail2Ban

apt install fail2ban -y

Configure and enable the relevant Fail2Ban jails and confirm that their filters match your service logs.

Configure Firewall

Allow the actual SSH port before enabling the firewall; OpenSSH below assumes port 22. TCP 80 is needed for standalone HTTP certificate validation and renewal. Open only the mail protocols you have configured, preserve console access and check renewal hooks reload the mail services.

Allow only required ports:

Dienst Haven
SMTP 25
SMTP Submission 587
SMTPS 465
IMAP 143
IMAPS 993
POP3 110
POP3S 995
HTTPS 443

Example using UFW:

ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 25
ufw allow 587
ufw allow 993
ufw allow 443
ufw enable

Spamfiltering

Without spam protection, mailboxes quickly become unusable.

Install Rspamd

apt install rspamd -y

Rspamd provides:

  • Bayesian filtering
  • DKIM validation
  • SPF validation
  • Reputation scoring

Install ClamAV

apt install clamav clamav-daemon -y

ClamAV can scan messages for malware after it has been integrated with the mail-filtering pipeline; package installation alone does not enable scanning.

Monitoring Email Deliverability

Even a correctly configured server requires ongoing monitoring.

Rekening:

  • Mail queue size
  • SMTP logs
  • Bounce reports
  • Blacklist status

Useful tools:

  • MXToolbox
  • Mail Tester
  • Google Postmaster Tools

Review logs regularly:

tail -f /var/log/mail.log

Backup Strategy

Email is often critical business data.

Back up:

  • Brievenbussen
  • Databases
  • Configuratiebestanden
  • SSL-certificaten

Recommended locations:

  • Remote VPS
  • Cloud storage
  • Backup server

Automated daily backups are strongly recommended.

Common Challenges

Haven 25 Blocking

Many VPS providers restrict outbound SMTP traffic.

Oplossingen omvatten:

  • Requesting port 25 activering
  • Using an external SMTP relay

Deliverability Issues

Most deliverability problems originate from:

  • Missing SPF
  • Missing DKIM
  • Missing DMARC
  • Incorrect reverse DNS

IP Reputation

New server IPs may have limited trust.

Gradually increase mail volume and maintain clean sending practices.

When Self-Hosting Email Makes Sense

Running your own mail server is a good option when:

  • You want complete control
  • You host multiple domains
  • You require enhanced privacy
  • You want to avoid per-user licensing fees

For organizations that prioritize simplicity and minimal maintenance, managed email services may remain the better choice.

Laatste gedachten

A VPS provides an excellent platform for hosting a professional email server. With proper DNS records, secure configuration, spam protection, SSL-codering, en regelmatige controle, you can operate a reliable email system that remains fully under your control.

Whether you choose an all-in-one solution such as Mail-in-a-Box or build a custom Postfix and Dovecot environment, a properly configured VPS can support secure, schaalbaar, and professional email services for businesses of any size.

Deel dit bericht

Geef een reactie

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *