Language & currency
Currency

Site Web gratuit & Serveur Migration

Colonel Serveur
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
  • Custom security policies
  • Professional branding
  • Support for multiple domains and users

What Is an Email Server?

An email server is responsible for sending, recevoir, 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

Hébergement Web WordPress

À partir de 3,99 $/mois

Acheter maintenant

Requirements Before You Start

Before deploying an email server, assurez-vous d'avoir:

Un VPS

Spécifications minimales recommandées:

Ressource Minimum
Processeur 1 CPU virtuel
BÉLIER 2 FR
Stockage 20 Go SSD
Adresse IP IPv4 dédié
Système opérateur 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]

Accès racine

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

Serveur VPS pas cher

À partir de 2,99 $/mois

Acheter maintenant

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

Hébergement VPS Windows

Accès à distance et administrateur complet

Acheter maintenant

Popular solution:

  • Dovecot

Webmail Interface

Provides browser-based email access.

Common options:

  • Roundcube
  • SnappyMail

Spam Protection

Filters unwanted messages before they reach users.

Popular tools:

  • SpamAssassin
  • Rspamd
  • ClamAV

Configuration DNS

Correct DNS records are essential for successful email delivery.

A Record

Create a hostname for your mail server.

Exemple:

mail.yourdomain.com → VPS_IP_ADDRESS

Enregistrement MX

Directs email traffic to your server.

Exemple:

Priority: 10
Mail Server: mail.yourdomain.com

SPF Record

Specifies which servers may send mail for your domain.

Exemple:

v=spf1 mx ip4:SERVER_IP -all

DKIM Record

Digitally signs outgoing messages to verify authenticity.

Exemple:

default._domainkey.yourdomain.com

DMARC Record

Provides instructions for handling authentication failures.

Exemple:

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.

Les fonctionnalités incluent:

  • Postfix
  • Dovecot
  • Filtrage anti-spam
  • Webmail
  • DNS management
  • Certificats SSL
  • Mises à jour automatiques

Installation

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:

  • Configuration du domaine
  • Administrator account creation
  • SSL setup
  • DNS recommendations

For most users, 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

Sélectionner:

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

Exemple:

adduser john

Boîte aux lettres:

[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.

Installer des certificats SSL

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.

Installer 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:

Service Port
SMTP 25
SMTP Submission 587
SMTPS 465
IMAP 143
IMAP 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

Filtrage anti-spam

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.

Vérifier:

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

Useful tools:

  • Boîte à outils MX
  • Mail Tester
  • Google Postmaster Tools

Review logs regularly:

tail -f /var/log/mail.log

Backup Strategy

Email is often critical business data.

Back up:

  • Boîtes aux lettres
  • Bases de données
  • Fichiers de configuration
  • Certificats SSL

Recommended locations:

  • Remote VPS
  • Cloud storage
  • Backup server

Automated daily backups are strongly recommended.

Common Challenges

Port 25 Blocking

Many VPS providers restrict outbound SMTP traffic.

Les solutions incluent:

  • Requesting port 25 activation
  • 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.

Pensées finales

A VPS provides an excellent platform for hosting a professional email server. With proper DNS records, secure configuration, spam protection, Cryptage SSL, et un suivi régulier, 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, évolutif, and professional email services for businesses of any size.

Partager cette publication

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *