Author Topic: How to block a domain zone using a regular expression?  (Read 1607 times)

Offline inverser

  • Newbie
  • *
  • Posts: 3
How to block a domain zone using a regular expression?
« on: May 25, 2023, 04:28:50 AM »
Hello. Tell me how to block a specific domain zone in spam filters? I've tried different regex options that I could find on your forum, but none of them worked.
I started getting emails from addresses like budapest@letterladder.bio, creed@tissuekiller.bio and others. Therefore, I want to completely stop receiving emails from the *.bio domain zone. Is it possible to do this?

Offline Dmitry42

  • Full Member
  • ***
  • Posts: 232
Re: How to block a domain zone using a regular expression?
« Reply #1 on: May 25, 2023, 09:56:39 AM »
You can use Filter and move all messages from *.bio to trash.

Offline inverser

  • Newbie
  • *
  • Posts: 3
Re: How to block a domain zone using a regular expression?
« Reply #2 on: May 25, 2023, 03:42:17 PM »
how exactly should I create it?
I tried with these settings, but the letters still come
regexp:
Code: [Select]
/*/.bio
Also tried (test from gmail):
Code: [Select]
\^*.com$
Code: [Select]
/!(@(google\.com|gmail\.com)$)/...Also tried

.....
Code: [Select]
/^[a-z-]+:\/\/[0-9A-Za-z]{20,}\.com/
« Last Edit: May 25, 2023, 04:13:47 PM by inverser »

Offline strcube

  • Newbie
  • *
  • Posts: 9
Re: How to block a domain zone using a regular expression?
« Reply #3 on: May 25, 2023, 04:57:43 PM »
how exactly should I create it?

I do this sort of thing with a combination of SpamAssassin and ProcMail (which wasn't supported for a few years but now is supported once again).

SpamAssassin looks at all inbound email and ranks them for whether or not they're spam and you can add rules that indicate to SA that it's not wanted. And then ProcMail moves it to the user's SPAM folder or just deletes it, etc. That can be done in several ways but I like (non-virtual) users to have control via their ~/.procmailrc file.

In fact, the user can do it all with ProcMail, without Spam Assassin, I think. For example, in my own ~/.procmailrc file I have (the --- lines denote start and end of an excerpt):

---
:0
* ^From:.*northlightcolor.com
spam

---

...Of course, this is done at the SMTP / MTA level as in my config, Postfix calls SpamAssassin and ProcMail...

Offline inverser

  • Newbie
  • *
  • Posts: 3
Re: How to block a domain zone using a regular expression?
« Reply #4 on: May 25, 2023, 05:45:23 PM »
strcube, thank you. I'll try to figure this out.