Overview
iKVM
Secure Login
Network Cards
Hard drives
Time
SSHFS
Basic DNS
Website DNS
Certbot SSL
Apache and PHP
Maria DB
Mail Server Basics
Mail Server SSL
Mail Server Spam
Mail Server Filters
Checklist
Backup
iKVM
Secure Login
Network Cards
Hard drives
Time
SSHFS
Basic DNS
Website DNS
Certbot SSL
Apache and PHP
Maria DB
Mail Server Basics
Mail Server SSL
Mail Server Spam
Mail Server Filters
Checklist
Backup
Last updated: August 2025
Mail Server Spam Filtering
Note: This article series covers configuring Debian 12 for hosting multiple domains and web sites on a single dedicated server. As such, some strategies may be inappropriate for your environment. Sockets for example are appropriate for communication between services hosted on the same machine but not suited to a set up with distributed services (where you'd use ports). Please consult the overview for more information.
Operating System: Debian 12
Postfix: version 3.7.11
Dovecot: version 2.3.19.1 (9b53102964)
Mail servers get a fair amount of unsolicited messages which you can filter using Postfix.
To check blacklisting services to see if the server communicating the message has been flagged for sending spam.
Edit the configuration:
sudo nano /etc/postfix/main.cf
Add or update smtpd_recipient_restrictions:
smtpd_recipient_restrictions = reject_unauth_destination, permit_sasl_authenticated, permit_mynetworks, reject_rbl_client zen.spamhaus.org, reject_rbl_client bl.spamcop.net, permitRestart Postfix:
sudo systemctl restart postfix
It's recommended to put the blacklist servers at the end of the restrictions to minimise resources.
reject_unauth_destination will prevent the server being used as a mail relay.
You can see I've added the Spamhaus and Spamcop services in this example but you can see they are simply defined by reject_rbl_client < domain name > lines in the smtpd_recipient_restrictions section.
2026