Postfix Spam Control

Reject / Discard / Redirect emails based on header checks :

vi /etc/postfix/
header_checks = regexp:/etc/postfix/header_checks

vi /etc/postfix/header_checks
/^From: "Mechanic/ REJECT
/^Subject: .*badWord/	DISCARD

Reject By Subnet Range (CIDR)

Add  to the recepient restriction in the main postfix configuration file :

vi /etc/postfix/
smtpd_recipient_restrictions = check_client_access cidr:/etc/postfix/block.cidr

Now create the block.cidr file and add any ip ranges in the CIDR format that you may want to block :

vi /etc/postfix/block.cidr
192.168.0/24          REJECT


Note : The postfix needs to be reloaded in order to re-read the changes in block.cidr file

You may also like...