dovecot does not filter emails by default, it requires an external application to do that, like sieve. Once you install sieve, you can filter incoming emails based on the X-Spam-Flag header and move them to a spam folder accordingly.
there are lots of guides on how to install and setup sieve with dovecot.
Hello, thanks for answering.
I followed the steps of this tutorial but I do not know if it will be the right one. I can not make it work.http://www.smartdomotik.com/2015/09/04/how-to-set-filters-in-roundcube-with-sieve/
Could you tell me a tutorial that works?
I have Postfix, Dovecot, Roundcube and SpamAssassinpamAssassin