How to block email in Mac Mail

Does anybody know how to block email in Mac Mail? Specifically I’m trying to block email that is from

.reg.ru

The address has lots of random preceding .reg.ru.

I tried a rule in Mac Mail to catch any email that has .reg.ru in the from box and to delete it. But that doesn’t seem to be working. Mac Mail does recognize .reg.ru as spam and puts it in the junk folder but the rule doesn’t activate to delete it. If I manually run the rule it works.

I realize that I could manually erase the junk mail folder but it would be nice to have it automatically exclude these nuisance spams. I’m getting a couple of dozen a day.

Thanks for any suggestions.

IIRC there’s an advanced option somewhere under the junk mail settings along the lines of “run rules before doing junk mail filtering”. I think that’s the option you want.

Or abandon Mail’s junk mail filter, in favour of doing things entirely server-side, or using a third-party filter (Spamsieve).

Yes. In Mail 13.4 on Catalina, it’s on the Junk Mail panel in Preferences, under the Junk Mail Behaviors tab. At the bottom is a checkbox for “Filter junk mail before applying my rules”. (It should be similar in more recent versions.) To have your rules applied first, make sure this box is unchecked.

Thanks for the suggestions. I did have Filter junk mail unchecked but the rule was not being applied automatically. I changed it slightly to looking for ,reg.ru at the end of the from area to see if that makes a difference.

If the rule works manually, it should work automatically — as long as it sees an unread message in the inbox. Since it is not working, probably the junk filter is applied server-side, before Mail ever sees the message. You will have to disable or bypass the junk filter on the server. How to do that depends on your email provider.

iCloud mail has a server-side junk filter. As far as I know, it cannot be turned off or modified. But you can make a server-side rule by logging into iCloud.com. That rule should be applied before the junk filter. If you are not using iCloud, you will have to find out from your provider how to do something equivalent.

Thanks. I’ll look into that. At least it’s being captured and it’s easy enough to manually empty the junk mail folder.

That box has been unchecked since ever, and I have the same problem as the OP (@dennishenley) (with a different rule, of course). This is with macOS 11.7.1 Big Sur, Mail 14.0 (3654.120.0.1.13), and a Gmail account.

Go to your web based mail and set up a filter there, in which case the email won’t even get to Apple Mail.

Here’s a suggestion (untested): Mail > Settings > Junk Mail, select “Perform custom actions”, click the Advanced… button. Try adding the condition highlighted in the example below. This is counter-intuitive, since you’re trying to get rid of these messages, but my hypothesis SWAG is that Mail is processing its internal Junk rule first, then running your rules on what’s left. By excluding these messages from Junk, they may be left as legitimate targets for your other rule that will delete them.

If so, you could probably also define a rule that runs against the Junk mailbox, deleting matching the target From line.

But yours might be faster if the OP doesn’t purge his spam folder very often.

Changing the custom actions didn’t work either, I suspect you are correct about mail processing the internal filters first. I guess another test would be to turn off junk mail filtering and just build a bunch of rules to handle it, But I really don’t want to do that since the internal stuff is working in that I haven’t had much spam in the inbox and my only complaint is having to manually empty the junk folder.

Thanks for the help everyone.

Rats. I really had high hopes for that one. Oh well. :slight_smile:

Yes, I think a big part of the problem here is that Mail’s rules can only work on mail that is delivered to the Inbox. Might it be possible to use a script to trigger rules on additional folders, or else move messages to the Inbox such that those rules are triggered on the messages moved? Hmm.

That’s what I was thinking too, hence the example above that was intended to exclude the target messages from being processed as Junk, presumably allowing them to proceed to the Inbox (where the OP’s “Delete” rule would take care of them).

1 Like

There is a provision for setting up server-side rules for iCloud mail, but the selection criteria and actions are more limited than the rule set in the Apple Mail set. In the Mail section of iCloud.com, you can get to the rule set through the Settings icon at the top of the mailbox list.