I have a couple dozen rules within Apple Mail and some have hundreds of lines. The latter are rules mostly to divert spam. I own several domain names and get endless spam to made-up or altered usernames on those domains.
I have no problem with fake usernames that end up on spammers' lists. I can easily add them to one of my "junk" rules.
any recipient contains [email protected] any recipient contains [email protected] any recipient contains [email protected] any recipient ends with [email protected]
The problem comes with more randomly generated names. For example, I discovered 3-4 fake usernames that start with "Anne." Ditto for multiple common names. Plus tons with numbers that start with the letter "x." These aren't just variations; they're autogenerated and I see new ones regularly.
No problem, for usernames I know I don't use, I can just set up lines that contain:
firstname.lastname@example.org email@example.com firstname.lastname@example.org
Except Apple Mail does not allow the use of wildcards in rules. Not * or ?.
I don't want to stop all mail that goes to an email that begins with "anne," for example. Because that will divert all mail that goes to my friend annelastname@domain-I-don't-own, including those sent to her as part of a group. Since it's not just one friend Anne but rather multiple ones, plus countless usernames that might start with "x" or "z" and so forth, whitelisting won't work. I must be able to put in my domain name as part of the rule.
I also don't want to create a separate rule for every instance. One where it meets the requirements of "contains username" and "contains domain name." Why? Because I'd need hundreds of them. I just want to add a new username set as a line in an existing rule.
Nor do I want to take the nuclear approach and change my domain name's settings at my ISP to junk every username I haven't specified (it's a pain to log in every time I whitelist a new username too). I already divert catch-all email to a "misc" account but I still have to go through it. I want to be able to identify selected username patterns as probably spam.
While a better anti-spam program would be nice, it's not what I'm asking about and I still need a direct answer to my question even if I had a better spam filter.
I'm open to Apple Scripts, though I don't yet know how to use it and don't know if it will work here.
How can I achieve the equivalent of using wildcards within Apple Mail?