Use antivirus.exim to delete SPAM emails

asmithjr

Well-Known Member
Jun 13, 2003
516
8
168
I'm trying to filter emails and send them to /dev/null when they are marked SPAM. below is a sample from the /etc/antivirus.exim file.
Code:
logfile /var/log/filter.log
if
 $header_subject: contains "SPAM"
then
 logwrite "$tod_log $h_from $h_to $header_subject (the subject contains SPAM)"
 save /dev/null
 finish
endif
I'm watching and see these messages get logged to /var/log/filter.log yet the messages end up in queue showing the From and To then eventually show up with bounce as the from.
I would like to just have the filter remove these messages all together as my queue will eventually fill up with these messages. Anyone have a solution to this. I've been on the forums for days trying to get this to work properly. I've even put the save /dev/null before the logwrite.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
Hi @asmithjr

When I create this filter through the UI I get the following

Code:
if
 $header_subject: contains "SPAM"
then
 save "/dev/null" 660
 finish
endif
Now I just used the Global Filters UI to create this but it can be copied to the exim filter as well. It is normal for these messages to be logged to the exim log as they are processed then discarded. If you paste the syntax in regard to sending the message to /dev/null do you continue to see bounces?

Thanks!