HOW TO: Discard spam emails in Exim

January 6, 2014

We can discard spam emails like citibank, paypal, hsbc etc from and to our server both incoming and outgoing emails.

 

Login to your cpanel server.

Main => Service Configuration => Exim Configuration Manager

Under Filter Section
/etc/cpanel_exim_system_filter_custom .By default this will be /etc/cpanel_exim_system_filter but this filter will be gone once you do a exim upgrade. So it is better to use a custom name.

Exim filters based on Subject:
========================
if

$header_subject: contains “viagra”

then

seen finish

endif
========================
if

$header_subject: contains “***SPAM***”

then

seen finish

endif
========================
Exim Filter Based on to Address

if (

$received_protocol is “local” or

$received_protocol is “esmtpa”

) and (

$header_from contains “@ebay.co.uk”)

then

seen finish

endif

========================

if (

$received_protocol is “local” or

$received_protocol is “esmtpa”

) and (

$header_from contains “@paypal.com”)

then

seen finish

endif

========================

en_USEnglish