Exim Custom Filter for outbound messages
Hi,
I'm trying to create a custom exim filter that will reject outgoing emails with specific text in the subject line.
I've created a new filter /usr/local/cpanel/etc/exim/sysfilter/options/server_custom_filter
And restart exim, but it's not blocking the outound emails. Do I need to rebuild /etc/cpanel_exim_system_filter, If so how? I don't see any refrence to my new rule in there . Here's the settings in WHM. Thanks
if ("$h_subject:" contains "Custom Text")
then
fail text "Email subject blocked by keyword"
seen finish
endif
And restart exim, but it's not blocking the outound emails. Do I need to rebuild /etc/cpanel_exim_system_filter, If so how? I don't see any refrence to my new rule in there . Here's the settings in WHM. Thanks
-
Hey there! That all looks correct, and you don't need to restart or rebuild anything else. Do you see anything helpful when you check the Exim logs at /var/log/exim_mainlog while sending a message that would trigger that filter? 0 -
Thanks, here's the log. 2022-11-22 17:07:27 SMTP connection from [X.X.X.X]:64686 (TCP/IP connection count = 1) 2022-11-22 17:07:30 1oxMRN-000BnD-QB <= removed@domain.com H=(SURFACEPRO8) [X.X.X.X]:64686 P=esmtpsa X=TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256 CV=no A=dovecot_login:removed@domain.com S=2589 id=005101d8fe38$b4610330$1d230990$@domain.com T="Custom Text" for removed@domain.com 2022-11-22 17:07:30 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1oxMRN-000BnD-QB 2022-11-22 17:07:30 1oxMRN-000BnD-QB => removed R=virtual_user T=dovecot_virtual_delivery C="250 2.0.0 kiX5FiJnfGMdsQAAvxTo3g Saved" 2022-11-22 17:07:30 1oxMRN-000BnD-QB Completed 2022-11-22 17:07:33 SMTP connection from (SURFACEPRO8) [X.X.X.X]:64686 closed by QUIT0 -
That's interesting, as that doesn't seem to indicate any forwarders are filters being used when that message is handled. Could you create a support ticket with our team so we could take a look at this on our end? 0 -
Thanks, will do! 0 -
Once you get that ticket submitted, if you could post the ticket number here I can follow along. 0 -
BassTeQ Yes, you should rebuild the Exim configuration and restart the service to include the custom filter on the Exim service there. If you check /etc/cpanel_exim_system_filter after rebuilding the Exim command, you will see that it is listed correctly there and reflect after the Exim service restart. 0 -
Yes, if you are changing the file mentioned there you would need to run those commands. If you are only making edits through the WHM interface, no additional commands are necessary. 0 -
Thanks all, I've run the commands and the filters are now working! Support team also helped to provide me details on how to test a filter from the command line, which is useful! exim -d-all+filter -bF /usr/local/cpanel/etc/exim/sysfilter/options/server_custom_filter < /root/test_email_from_file0 -
Glad to hear! and thanks for the command to test the filter :) 0
Please sign in to leave a comment.
Comments
10 comments