R-Ts NetWorks

Server the Best

How to block emails from a specific address using Exim


How to block emails from a specific address on a cPanel/WHM server using Exim ?

Solution :

This is fairly easy to achieve with Exim.
First you’ll need to find the system filter file for Exim. This can be found out through WHM >> Main >> Service Configuration >> Exim Configuration Editor.
Towards the middle of the page, under the section ‘Filters’ , you ‘ll find the path to the file.
Open that file via SSH using your favorite editor and add the following to it :

if first_delivery
and ( (“$h_from:” contains “emailtoblock@domainname.com”)
)
then fail
endif

If you would like a copy of the email to be sent to you after the message fails, use the following code :

if first_delivery
and ( (“$h_from:” contains “emailtoblock@domainname.com”)
)
then
unseen deliver “youremail@yourdomainname.com”
fail
endif

Make sure that you substitute the correct email addresses in the above code.

Advertisements

October 13, 2012 - Posted by | Linux

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: