Skip to main content

Combine Email filters?

Comments

7 comments

  • cPanelMichael
    Hello, This is discussed on the following thread: Global email lists/filters files in the cPanel directory Thank you.
    0
  • hayridumanli
    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
  • cPanelMichael
    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
  • hayridumanli
    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
  • cPanelMichael
    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
  • hayridumanli
    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
  • cPanelMichael
    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.