If you’re like me, you don’t use your VPS server for incoming mail. Instead, I only want to receive e-mails from my VPS for server events. But the hassle of configuring an incoming mail server, dealing with spam, storage issues, and more are too much for me. Instead, I outsource all that to a dedicated service. But if you use a managed VPS server like NameHero, the services that accept incoming mail are still active. Here’s how to disable them.
Find the Right Modules to Disable
The challenge is to disable the mail modules that accept incoming mail without disabling the modules that sent outgoing mail. With NameHero, I use the InterWorx web hosting control panel, so when you log into your dashboard, you first see a list of VPS modules and the current enabled or disabled status. For my VPS, here is what I see:
You can see that I’ve disabled four main services:
- Spam Filtering
- Virus Filtering
At the same time, I’ve kept the “Outbound Mail” and SMTP server modules. I find that this is sufficient to ignore all incoming mail and still receive VPS e-mails for things like backups and OS updates.
You Can Disable the MDA Module
MDA stands for “Message Delivery Agent”, and if you search for what it does, you might get the impression that you need it for outgoing mail. But you don’t. In the InterWorx dashboard, I’ve disabled the MDA module entirely:
This is nothing but Dovecot, which you can disable directly from the home screen as shown above.
That’s Fine – But Why Disable Virus Filtering? Isn’t that Dangerous?
You might not know that the “virus filtering” module in a VPS primarily deals with incoming message attachments. It’s not a traditional anti-virus that you run on your Windows PC at home. Instead, the most popular anti-virus software for Linux servers is called ClamAV, which uses a huge amount of memory – up to 40% of available memory on my VPS server with 2GB RAM.
ClamAV’s main purpose is to scan mail attachments for viruses. The threat vectors that make a desktop PC an attractive target don’t exist on a Linux VPS server. So if you disable all incoming mail functionality, then there’s no need for your to install an anti-virus software either. As a result, disabling the antivirus on Linux is safe.
Hardening the VPS Server is More Important
Instead of anti-virus, a server needs to be “hardened” by disabling root logins via SSH, configuring your firewall, changing the port, and much more. You can even disable logins via passwords and require SSH keys. The point is that, unlike a desktop PC, anti-virus isn’t much help for a Linux VPS and requires different precautions.
Ensure that your VPS Outgoing E-mails Aren’t Marked as Spam
If you haven’t already, make sure that you add SPF records to your domain nameservers so that you receive important notification emails from your servers. Otherwise, e-mail providers like Gmail and Outlook can mark them as spam – and you might not even notice until a few months later. It happened to me!
Use Cloudflare’s E-mail Routing for Free Incoming Mail Service
You can leverage Cloudflare’s free incoming mail routing service to forward e-mails to your Gmail, Outlook, or Yahoo e-mail provider for easy incoming mail handling. It works great, and I can create as many disposable e-mails as I want, and Cloudflare automatically filters out junk like spam. The best part is that you don’t have to worry about configuring a VPS server to receive your e-mail and deal with the hassle of scanning attachments and forwarding mail.
So take my advice and block incoming mail on your VPS. If you require full-fledged mail functionality, I suggest you outsource your e-mail needs to a 3rd party that knows what they’re doing.
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!