[CentOS] Spamassassin + Postfix : delete spam mail on the server ?

Tue Dec 18 09:58:30 UTC 2018
Pete Biggs <pete at biggs.org.uk>

> The problem with this setup is that spam mail is still delivered, and I
> need Thunderbird's filters to weed out incoming mail. And when I'm using
> my webmail (running SquirrelMail), my inbox is a tsunami of unread
> [SPAM] messages.
> So I'd like to go a step further and delete all messages flagged [SPAM]
> directly on the server. It doesn't look like Spamassassin provides this
> functionality.

Spamassassin just tags things, it doesn't interact with the final mail
delivery. What you need is some form of server-side filtering

My (limited) expertise in MTAs is with Exim and that has an extensive
filter syntax that goes in the user's .forward file - I use that to
pre-filter my mail before the MUA sees it.  From my .forward file:

       $h_X-Spam-Flag: contains "Yes"
       save  Maildir/.spam/

   if $header_subject: contains "[CentOS" then
   	save Maildir/.CentOS/

If you don't want to use a different MTA, then the classic way of doing
server side filtering is using procmail.  I'm certain there will be
lots of HowTos out there on how to set it all up with Postfix.

Finally, I would be quite surprised if there is no built-in filtering
of some form with Postfix, but from the articles I've just been looking
at it doesn't seem to be a simple process.