on
dns
technitium
ubuntu
- Get link
- X
- Other Apps
Postfix allow email header inspection using regex pattern for custom mail filtering.
1. Add below configuration to /etc/postfix/main.cf.
header_checks = regexp:/etc/postfix/header_checks
2. Create the header_checks file with your regex filtering pattern.
/^(From|Sender|Return-Path):.*\.top/ HOLD Blacklisted .top domain
/^(From|Sender|Return-Path):.*@gmail\.com/ DISCARD gmail.com
/^(From|Sender|Return-Path):.*user@gmail\.com/ REJECT gmail.com
3. Create the header_checks map files.
sudo postmap /etc/postfix/header_checks
4. Restart postfix service.
sudo systemctl restart postfix
5. Monitor postfix log.
6. Use postmap -q to regex query the header_checks.
postmap -q "string" regexp:/etc/postfix/header_checks
Comments