You can only effect inbound email with a Mail rule. The spammers may use one or more email servers to send you different From header content that varies by email address that has nothing to do with the originating server. Trying to write a rule to address this type of spamming nonsense will exhaust and anger you. What I have had success with is an email header field that is not on the Mail header menu by default. This is Return-Path, which points at the originating mail server, regardless of the gibberish that may be in the From header field.
I was receiving around 30 spams a day from what looked like a variety of sources in the From header. When I started looking at the Return-Path for these emails, I noticed a pattern that in many cases on varied by a single character. When I set up rules to handle emails from certain partial Return-Path servers, I was able to handle all of the spam from those servers. Here is what I created in Mail Preferences : Rules : Junk_2:

The actual Return-Path header strings are quite long and end in the actual server name. The similar patterns control several SPAM messages from a single organzation, and you can see there are four shown here. Does not matter what game they play in the From header field, I move all of their matching emails to Trash with these rules.
In Mail, select a single email that you know is SPAM. Then visit Mail Preferences : Rules and Add Rule, and then edit it.
By default, Return-Path is not a default header field selection in Apple Mail, and you would ordinarily see From instead. Click on that From entry and you see a long menu of selectables with the Last item on the menu being Edit header list… . Select that, and enter a new Header item name spelled exactly as Return-Path, and then add it.
Remember, your SPAM email message is still selected. In your Mail rule, change the default From header to the newly added Return-Path, set the middle selection to contains, and the Return-Path address of the orginating server will automatically populate on the right. Now, onto the Perform the following actions section. I have [ Move Message ] to mailbox: [ All Trash ]. When you click OK, it will offer to apply the rule and when it does, your selected message gets whacked into Trash.
Select the next SPAM email, and then repeat editing your Mail rule, adding + another Return-Path header entry, and clicking OK to apply it and impact that specific SPAM message. It shouldn't be too long before you see a pattern and a drop in SPAM coming to your Inbox.