EXIM custom filter problem/question

ksechrist

Active Member
Jan 27, 2019
31
5
8
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 "[email protected]")
or ("$h_from:" is "[email protected]")
and not ("$h_X-Spam-Checker-Version:" begins "SpamAssassin")
then
unseen deliver "[email protected]"
endif
if first_delivery
and ("$h_from:" is "[email protected]")
and not ("$h_X-Spam-Checker-Version:" begins "SpamAssassin")
then
unseen deliver "[email protected]"
endif
if first_delivery
and ("$h_from:" is "[email protected]")
and not ("$h_X-Spam-Checker-Version:" begins "SpamAssassin")
then
unseen deliver "[email protected]"
unseen deliver "[email protected]"
endif
 

ksechrist

Active Member
Jan 27, 2019
31
5
8
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?
 

ksechrist

Active Member
Jan 27, 2019
31
5
8
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.
 
  • Like
Reactions: cPanelMichael

ksechrist

Active Member
Jan 27, 2019
31
5
8
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!
 

ksechrist

Active Member
Jan 27, 2019
31
5
8
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 "[email protected]")
and not ("$h_X-Spam-Checker-Version:" begins "SpamAssassin")
then
unseen deliver "[email protected]"
endif
 
  • Like
Reactions: cPanelMichael