Yesterday, before going to bed, I thought about how to deal with mail spam advertising sites with Viagra and illegal software (it should be illegal, it should be free! And not at half price :) etc ...
As one of the methods of checking - check the links that are advertised in the letter and analyze the text on these pages. If “miracle medicine” or “software at reduced prices” is advertised there, then mark the letter as spam.
Also create a separate database of IP addresses and domains that belong to spammers. ')
It is clear that the idea is far from perfect, but this is like a rough outline, a more detailed plan of action can be worked out in the course of implementation.