Combine Email filters?
Hi,
I have read a lot about e-mail filter in forum, but I couldn't find the correct answers for myself.
1) I created a lot of Email Filters for user@domain.com (for an e-mail), it's mostly "Subject" " contains" "spam_word" = "Discard message"
And some "From" "contains" "spammer@spam.com" = "Discard message"
And the filters are working, no problem.
First question is;
Where is that filter file, I read in the forum, but I couldn't find the file which has filters in it. I looked at /etc/vfilters/domain.com, but I cannot change to domain.com folder, it's somewhat restricted.
2) If I can find the file, I want to combine the filters with "or" s, then I can manually edit the file to add new spam words or spam mails. This will be the second question if I can find the filter filer.
-
Hello, This is discussed on the following thread: Global email lists/filters files in the cPanel directory Thank you. 0 -
Thank you for your reply. I had seen this thread, but it didn't work as below; I go to /etc/vfilters/ folder and I can see the files in that folder, there are domain names (as written $domain), but when I try to edit the file, such as vi caffenotte.com, the file is empty, there is nothing in the file. So, the filters are not in this file I guess, that's why I am asking the filter file's directory. 0 -
Hello, Are you browsing to the global /etc/ directory as root via SSH, or the account's /home/$username/etc/ directory while logged in via SSH as the account username? Thank you. 0 -
OK, here is the answer I wanted, thank you. I browsed /home/$username/etc/@domain/@mail and I see 3 files there; filter, filter.cache and filter.yaml Now, which file I will edit? 0 -
Hello, You can view the file named "filter.yaml" to see the existing rules, however note that if you want to actually edit the filter rules via the command line, the only supported method of doing so is via a UAPI function: UAPI Functions - Email::store_filter - Software Development Kit - cPanel Documentation Thank you. 0 -
Actually that UAPI functions you mentioned are so complicated than I can handle, all I want to ask is like that; Let's go on with 2 example filters in filter.yaml file; actions: - action: save dest: /dev/null enabled: 1 filtername: 10 SAATTE INGILIZCE EGITIM SETI rules: - match: contains opt: or part: "$header_subject:" val: 10 SAATTE INGILIZCE EGITIM SETI unescaped: 1 - actions: - action: save dest: /dev/null enabled: 1 filtername: 2017 Is ve Sektor rules: - match: contains opt: or part: "$header_subject:" val: 2017 Is ve Sektor unescaped: 1 If I combine them like this; actions: - action: save dest: /dev/null enabled: 1 filtername: All subject filters rules: - match: contains opt: or part: "$header_subject:" val: 10 SAATTE INGILIZCE EGITIM SETI or val: 2017 Is ve Sektor unescaped: 1 - Is it OK? So that I can combine all the filters with "or"s. 0 -
If I combine them like this; actions: - action: save dest: /dev/null enabled: 1 filtername: All subject filters rules: - match: contains opt: or part: "$header_subject:" val: 10 SAATTE INGILIZCE EGITIM SETI or val: 2017 Is ve Sektor unescaped: 1
Hello, No, that's not the correct format. The combined rules would instead look like this in the YAML file:--- filter: - actions: - action: save dest: /dev/null enabled: 1 filtername: All subject filters rules: - match: contains opt: or part: "$header_subject:" val: 10 SAATTE INGILIZCE EGITIM SETI - match: contains opt: or part: "$header_subject:" val: 2017 Is ve Sektor unescaped: 1 version: '2.2'
However, that said, manually editing the filter.yaml file is unsupported. It won't automatically update the other filter files, and could lead to the system overwriting the changes. Instead, you'd need to use the UAPI function referenced in my previous post, or the cPanel UI to make the changes. Thank you.0
Please sign in to leave a comment.
Comments
7 comments