Let Postfix handle spam in two ways

Solution 1:

You could setup another smtp listener process in your master.cf to handle your outgoing mail. Something like the following should get you started with one listening on port 26:

26        inet  n       -       n       -       18       smtpd -o header_checks=[your checks] mydestination= relayhost=

You may need to tweak that slightly, to disable local delivery and not to accept mail from anywhere except localhost. You'd then want to add the following to your main.cf

relayhost=127.0.0.1:26

And of course, drop your header checks out of that file.

Mail out would be relayed into the second smtpd process on 26 which would then drop messages that fail as spam. You can also specify a relayhost in that listener if you need pass your mail to a downstream server rather than delivering directly.

You'd then go about setting up the rest of your filtering for your local users with Dovecot like you'd already suggested.

You will of course want to consdier how many mail hops you add to your message when doing this as some mail providers will drop messages with a considerable number of hops (gmail for instance drops after something like 10 or 15