Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Combine Email filters?

Discussion in 'E-mail Discussions' started by hayridumanli, Nov 28, 2017.

Tags:
  1. hayridumanli

    hayridumanli Member

    Joined:
    Jan 11, 2014
    Messages:
    23
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    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.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,734
    Likes Received:
    1,706
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  3. hayridumanli

    hayridumanli Member

    Joined:
    Jan 11, 2014
    Messages:
    23
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    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.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,734
    Likes Received:
    1,706
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
  5. hayridumanli

    hayridumanli Member

    Joined:
    Jan 11, 2014
    Messages:
    23
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    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?
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,734
    Likes Received:
    1,706
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  7. hayridumanli

    hayridumanli Member

    Joined:
    Jan 11, 2014
    Messages:
    23
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    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.
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,734
    Likes Received:
    1,706
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator

    Hello,

    No, that's not the correct format. The combined rules would instead look like this in the YAML file:

    Code:
    ---
    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.
     
Loading...

Share This Page