Log inSign up

Filter incoming mail with Proxmox Mail Gateway

Install Proxmox Mail Gateway from its package repository on a fresh Debian 13 (or Debian 12 for the previous release), sign in to the web interface on port 8006, add example.net as a relay domain and your mailbox server as the default relay, then point your MX record at the gateway. Open a support ticket first to confirm outgoing port 25 and to request PTR, because the gateway delivers with SMTP; an authenticated relay on port 587 is the dependable outbound route.

Topic: Email servers · Tested on: Debian 12 and 13 · Updated 2026-12-03

Confirm port 25 and PTR with support

A gateway receives on port 25 and forwards on port 25, so confirm what your server may do before you buy into the design. Ask support by ticket whether outbound port 25 is open for the gateway instance and for the mailbox server, and request reverse DNS (PTR) for the gateway address, for example mx.example.net. Forwarding to your own mailbox server on another BitcoinVPS instance can use a different port if needed, and outgoing mail to the wider internet is most reliable through an authenticated relay on 587, explained in the SMTP relay guide.

How does a mail gateway fit in front of a mail server?

Your MX record points to the gateway instead of the mailbox server. The gateway accepts mail for your domains, scores it for spam with SpamAssassin rules, scans attachments with ClamAV, applies your rules, quarantines what is doubtful and forwards the rest to the real mail server. That server can then accept port 25 only from the gateway address. The gateway also has an internal port (26 by default) where your own servers can hand it outgoing mail for scanning before it leaves.

Give the gateway its own server. Proxmox recommends at least 4 GB of memory, so A2-4 is the floor and A4-8 fits a busier domain. Deploy a clean Debian 13 image for the current release, or Debian 12 for the previous one; installing on top of other software is not supported.

Prepare the hostname and resolver

The gateway insists that its hostname resolves to its public address, not to a loopback address.

sudo hostnamectl set-hostname mx.example.net
sudo sed -i "/127.0.1.1/d" /etc/hosts
echo "198.51.100.24 mx.example.net mx" | sudo tee -a /etc/hosts
hostname --ip-address

The last command must print 198.51.100.24. In DNS, create A and AAAA records for mx.example.net. Leave the MX record alone until the gateway is configured and tested.

How do I add the repository and install the gateway?

Use the no subscription repository, which is free and fine for single servers. For Debian 13 (Proxmox Mail Gateway 9):

sudo apt update && sudo apt install -y wget
sudo wget https://enterprise.proxmox.com/debian/proxmox-archive-keyring-trixie.gpg -O /usr/share/keyrings/proxmox-archive-keyring.gpg
sudo tee /etc/apt/sources.list.d/pmg.sources >/dev/null <<EOF
Types: deb
URIs: http://download.proxmox.com/debian/pmg
Suites: trixie
Components: pmg-no-subscription
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
EOF
sudo apt update && sudo apt full-upgrade
sudo apt install proxmox-mailgateway

For Debian 12 (version 8), use the bookworm key and a one line source instead:

sudo wget https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg
echo "deb http://download.proxmox.com/debian/pmg bookworm pmg-no-subscription" | sudo tee /etc/apt/sources.list.d/pmg.list
sudo apt update && sudo apt full-upgrade
sudo apt install proxmox-mailgateway

The package replaces any existing Postfix configuration with its own. Confirm the version and reboot:

pmgversion
sudo reboot

Which ports does the firewall need?

Open 25 to the world, 8006 only to your own address and 26 only to servers that relay outgoing mail through the gateway.

sudo apt install ufw
sudo ufw allow OpenSSH
sudo ufw allow 25/tcp
sudo ufw allow from 203.0.113.7 to any port 8006 proto tcp
sudo ufw allow from 198.51.100.50 to any port 26 proto tcp
sudo ufw enable

Here 203.0.113.7 stands for your office address and 198.51.100.50 for the mailbox server. The UFW guide covers safe enabling.

How do I configure relaying in the web interface?

Browse to https://mx.example.net:8006 and sign in as root with realm PAM (set a root password with sudo passwd root first if your image only uses keys). Then work through Configuration:

  • Mail Proxy, Relaying: set Default Relay to the mailbox server, for example mail.example.net, port 25.
  • Mail Proxy, Relay Domains: add example.net and every other domain you filter.
  • Mail Proxy, Ports: keep external 25 and internal 26.
  • Mail Proxy, Networks: add the mailbox server address so it may send through the internal port.
  • Mail Proxy, Options: set the message size limit and enable receiver verification if your mail server rejects unknown users cleanly.
  • Spam Detector, Options: keep the default heuristic score and turn on Bayes filtering.

For outgoing mail beyond your own network, set a smarthost under Relaying that points to your 587 relay if your release supports the needed authentication, or let the mailbox server send through the relay directly and use the gateway for inbound filtering only.

Adjust filter rules and the quarantine

The Mail Filter section ships with ready rules: viruses are blocked, high scoring spam is quarantined and lower scores are marked in the subject. Change the spam level thresholds under the What objects to fit your users, and under Configuration, Spam Detector, Quarantine enable the daily spam report so each user gets a digest with release links. Administrators manage held messages under Quarantine.

How do I test before switching the MX record?

Send a message straight to the gateway and follow it:

sudo apt install swaks
swaks --to deploy@example.net --server mx.example.net --port 25
sudo tail -f /var/log/mail.log

Then open Tracking Center in the web interface, search for the message and check that it was delivered to the mailbox server. When it arrives, change the MX record for example.net to mx.example.net, lower its TTL beforehand, and finally restrict port 25 on the mailbox server to the gateway address. Keep your SPF, DKIM and DMARC records aligned with whichever host sends outbound mail.

Maintain and update the gateway

Updates come through sudo apt update && sudo apt full-upgrade and also from the Updates panel in the interface. Back up the configuration with Administration, Backup/Restore and copy the archive off the server, or enable the daily backups add-on. Moving between major releases follows the upgrade notes Proxmox publishes for each version.

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
A2-4the recommended memory for a small domain2 vCPU, 4 GB RAM, 100 GB NVMe$14.40/mo$43.20 for 3 months
A4-8more traffic and faster virus scanning4 vCPU, 8 GB RAM, 180 GB NVMe$28.80/mo$86.40 for 3 months

Questions about Proxmox Mail Gateway spam filter

Can I install Proxmox Mail Gateway from its ISO?

Custom ISO uploads are not offered, so install the packages on the Debian image as shown here. The result is the same software.

Does the gateway need outgoing port 25?

To forward to an internal server you control, any agreed port works. For delivery to the internet, ask support by ticket about port 25 and prefer an authenticated relay on 587.

How do I set reverse DNS for the gateway?

Open a support ticket with the gateway IP addresses and the name mx.example.net; PTR is set by support.

Is the no subscription repository safe for production?

It receives the same software, released slightly earlier than the enterprise repository. Many single server setups use it; test updates on a quiet day.

Can one gateway filter several domains?

Yes. Add each as a relay domain and use transports when different domains live on different mailbox servers.