Disallow a site from sending out emails

Posted by HappyPike, 05-04-2007, 12:51 AM
Hi, Is there a way to disallow a certain site from sending out emails, while allowing other sites on the same server? My server uses Cpanel. Also, is there a way to only tar files of a certain type, such as PHP, recursively from a directory? Thanks.

Posted by ThinkSupportAdmin, 05-04-2007, 03:01 AM
You can remove the domain entry from the file /etc/localdomains This will disallow emails for that domain.. Yes you can tar particluar files -- you may want to use additional commands -- cp *.php xyzfolder tar -xzvf new.tar.gz xyzfolder/

Posted by HappyPike, 05-04-2007, 03:11 AM
Thanks for the help, ThinkSupportAdmin!

Posted by ThinkSupportAdmin, 05-04-2007, 03:37 AM
Cheers HappyPike

Posted by HappyPike, 05-04-2007, 03:48 AM
BTW, is there anything wrong with this htaccess file? I added my IP to the deny list and it doesn't seem to work.

Posted by Linuxsurgeon, 05-04-2007, 06:38 AM
when you are looking at putting a block for an IP you can do it using following rules.

Posted by brianoz, 05-04-2007, 06:58 AM
Another way of preventing a site from sending out email is to put a line like in the file /var/cpanel/maxemails. Not sure if this would be more effective than the localdomains idea.

Posted by senne, 05-04-2007, 06:32 PM
recursively find . -name "*.php"|xargs tar cvf php.tar

Posted by HappyPike, 05-04-2007, 07:58 PM
Thank you all for the quick replies. I will give those commands a try soon. For the htaccess problem, I removed those tags and this works: Fortunately I don't need to deny a site from sending emails now. For the past few days my server were sending out tons of spam emails. I checked the apache log and found that the spammer was injecting an insecured PHP file with a text file containing PHP mailer codes located on a free hosting site. I fixed the page and banned the spammer's IPs. Last edited by HappyPike; 05-04-2007 at 08:05 PM.

Posted by HappyPike, 05-04-2007, 08:11 PM
Thanks, senne! I just tried the command and it worked very well! It retains the directory structure too!!

Posted by brianoz, 05-05-2007, 12:48 AM
That's a really bad idea - it won't work, but will look like it did! It will work well provided you don't have more than a very few files, but will invisibly lose some of the files if you have more than a very few, as xargs will run tar once for the first batch and once for the second. What you want is: That may only work on some linux/unix versions of tar, so you may instead be able to use the inferior: The problem with this second method is that it also won't work for large numbers of files, although you'll get an error message.

Was this answer helpful?

 Print this Article

Also Read

CSS,JQuery,Images etc are not working

Posted by Rezaa, 10-26-2012, 05:10 AMI have a big problem with my website. I just transfered my...

Documenting downtime

Posted by yosmc, 05-04-2007, 10:30 AMI'm having a bit of a quabble with my current host because...

PHP Foreach Loop Issue...

Posted by Calibur747, 02-12-2011, 05:09 PMHello WHT, I am having an issue where some users are...

clamscan command

Posted by persianwhois, 04-21-2009, 05:04 AMCan you please provide a clamscan ssh command for...

Sprynex ?

Posted by zshelton, 09-04-2002, 12:27 AMDoes anyone here have any experience with Sprynex? good...