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!

EXIM custom filter problem/question

Discussion in 'E-mail Discussion' started by ksechrist, Apr 29, 2019.

Tags:
  1. ksechrist

    ksechrist Active Member

    Joined:
    Jan 27, 2019
    Messages:
    27
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    I'm still new to a lot of this but did much research before moving forward.
    I created a custom filter to forward inbound emails for a few users.
    I know the filter is activated, because I can see that it imported into /etc/cpanel_exim_system_filter

    I found several variations on the following, and tried all of them, including with/without quotes, and escaping the dots in the email addresses (single, double and quad slash)

    Something must be wrong in my syntax or code but I'm at a loss and would appreciate any help! Here's my last attempt (note the dotted email addresses, and altho I doubt it matters, I'm forwarding to a 2nd domain)

    Code:
    # Exim filter
    if first_delivery
    and ("$h_from:" is "user1.lastname@example1.com")
    or ("$h_from:" is "user2@example1.com")
    and not ("$h_X-Spam-Checker-Version:" begins "SpamAssassin")
    then
    unseen deliver "user1@example2.com"
    endif
    if first_delivery
    and ("$h_from:" is "user2.lastname@example1.com")
    and not ("$h_X-Spam-Checker-Version:" begins "SpamAssassin")
    then
    unseen deliver "user2@example2.com"
    endif
    if first_delivery
    and ("$h_from:" is "user3.lastname@example1.com")
    and not ("$h_X-Spam-Checker-Version:" begins "SpamAssassin")
    then
    unseen deliver "user2@example2.com"
    unseen deliver "user3@example2.com"
    endif
    
     
  2. ksechrist

    ksechrist Active Member

    Joined:
    Jan 27, 2019
    Messages:
    27
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    fwiw I think I fixed this by putting each "if" in its own custom filter file. A few successful tests so far, so fingers crossed...
     
  3. ksechrist

    ksechrist Active Member

    Joined:
    Jan 27, 2019
    Messages:
    27
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    Not fixed. I know it's working for the two separate filters I added with my test accounts. But it's definitely not working for one of my users. I see their outgoing email in the logs, but no filter ever kicks in. Is there something a user could do to override the custom filter?
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,325
    Likes Received:
    2,157
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @ksechrist,

    Can you open a support ticket so we can take a closer look? You can post the ticket number here and we'll link this thread to it.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. ksechrist

    ksechrist Active Member

    Joined:
    Jan 27, 2019
    Messages:
    27
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    Thanks Michael. I'm running one more test now - I changed the forwarding address on the non-working filter to be the same as one of the working filters. If that fails, I will open a ticket, because I'm out of ideas.
     
    cPanelMichael likes this.
  6. ksechrist

    ksechrist Active Member

    Joined:
    Jan 27, 2019
    Messages:
    27
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    support ticket 12179075

    After a few more tests, I learned that having 2 "unseen deliver" lines does not work on my server (and it should?) - I had this in the non-working filter.

    So I created local aliases for the non-working and one of the working filters - this is working for one of my test filters, but still not working for this particular user. More details in the support ticket.

    Thank you for any help you can offer!
     
  7. ksechrist

    ksechrist Active Member

    Joined:
    Jan 27, 2019
    Messages:
    27
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    In case anyone is experiencing a similar problem, this is what finally got the outgoing filter to work - I had to use $sender_address - here's the full working custom filter:

    Code:
    # Exim filter
    if first_delivery
    and ("$sender_address:" contains "user@example.com")
    and not ("$h_X-Spam-Checker-Version:" begins "SpamAssassin")
    then
    unseen deliver "user2@example2.com"
    endif
    
     
    cPanelMichael likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice