SOLVED Exim Filter - redirect to an email

Arvy

Well-Known Member
Oct 3, 2006
148
11
168
Brazil
cPanel Access Level
Root Administrator
Twitter
Hi there,

I want to create an Exim filter to redirect messages with one specific text in the body to an specific email.

I have a similar rule to discard messages:

if $message_body contains "FILTERED TEXT"
then
fail text "Reason filtered text"
seen finish
endif


Instead of log and discard, I want to log and redirect to one email, but message cannot be delivered to the original recipient.

I did:

if $message_body contains "FILTERED TEXT"
then
fail text "Reason filtered text"
deliver "[email protected]"
seen finish
endif


but it's not working... any tips?

Note: I'm changing /etc/cpanel_exim_system_filter_personal (not the original one) and already changed the Exim filter file on WHM.

Thank you.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
This will log either way but you're failing the message still.
18. The fail command
When Exim’s filtering facilities are being used as a system filter, the fail command is available, to force delivery failure. Because this command is normally usable only by the system administrator, and not enabled for use by ordinary users, it is described in more detail in the main Exim specification rather than in this document.

You'd need to do something like:


Code:
if
 $message_body contains "stuff_I_hate"
then
 deliver "[email protected]"
endif
If you wanted to log a specific message you would want to use logwrite I believe. You can get more information her: 3. Exim filter files
 
  • Like
Reactions: Arvy