Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: inverser on May 25, 2023, 04:28:50 AM

Title: How to block a domain zone using a regular expression?
Post by: inverser 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 [email protected], [email protected] and others. Therefore, I want to completely stop receiving emails from the *.bio domain zone. Is it possible to do this?
Title: Re: How to block a domain zone using a regular expression?
Post by: Dmitry42 on May 25, 2023, 09:56:39 AM
You can use Filter and move all messages from *.bio to trash.
Title: Re: How to block a domain zone using a regular expression?
Post by: inverser 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: /*/.bio
(https://inverser.pro/images/1/2023-05-25_22-40.png)
Also tried (test from gmail):
\^*.com$
/!(@(google\.com|gmail\.com)$)/
...Also tried
(http://inverser.pro/images/1/2023-05-25_23-02.avif)
.....
/^[a-z-]+:\/\/[0-9A-Za-z]{20,}\.com/
Title: Re: How to block a domain zone using a regular expression?
Post by: strcube on May 25, 2023, 04:57:43 PM
Quote from: inverser on May 25, 2023, 03:42:17 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...
Title: Re: How to block a domain zone using a regular expression?
Post by: inverser on May 25, 2023, 05:45:23 PM
strcube, thank you. I'll try to figure this out.