CloudLinux.ro
Email

How to secure a mail server

Updated 7/20/2026

An open mail server (open relay) is immediately exploited to send spam, and your IP ends up on blacklists. Securing it is mandatory.

1. Do not be an open relay

The server must accept sending only from authenticated users. Verify that it does not relay messages from anyone.

2. Force TLS

All connections (SMTP, IMAP) must be encrypted. Use a valid certificate, see free SSL certificate.

3. Require authentication

Sending (port 587) requires a username and password. Use strong passwords for each mailbox.

4. Firewall and fail2ban

Open only the email ports and protect them from attacks, see fail2ban and UFW.

5. Rate-limit sending

Put a per-account hourly message limit, so a compromised account cannot send thousands of spam messages.

6. Filter spam

Add filtering for incoming and outgoing messages, see spam filtering with Rspamd.

7. Update

Keep software up to date, see automatic security updates.

Put this guide into practice on your own VPS

EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.

See pricing

Related tutorials