Block spam using Postfix

I am getting constant spam from different email addresses but with similar template.

The spam template looks like this. After googling i came to know that I can block emails using “Body Checks” with Postfix.

So, what I did:

So, I added

body_checks = pcre:/etc/postfix/body_checks

on /etc/postfix/ with the content:

/My malware uses the driver/    REJECT


sudo postmap /etc/postfix/body_checks
sudo systemctl restart postfix

However, I’m still receiving spam of that same template, what am I doing wrong?

What email clients are you using? My experience is they usually they do a pretty good job after marking such emails as spam.

And using the built in filters works even better … and much less hassle. For a normal user can not make this kind of adjustment to Postfix.

Mailbird does not offer Filters/ Rules capability.

Spam rules are usually separate from user filters or rules. By marking something as spam, the client will learn what is spam.

This should also be implemented at the server level. I’m actually not sure how MiaB has implemented its various spam protection features, but when I used to roll my own I recall this as being nearly default in SpamAssassin. When moving an email from the IMAP Inbox to the Junk folder, the user is training SpamAssassin on what is spam.

I have this in my setup
body_checks = regexp:/etc/postfix/body_checks

more body_checks
/[a-zA-Z0-9_]/[a-zA-Z0-9_]/[0-9].zip./ DISCARD SPAM_REGLA_BODY_1

Hope it helps,
For me it used to work.


1 Like