Lately I have been getting lots of emails on some sites registering that are spam. Even with all my things to try to prevent it that I have tried it is an ongoing battle and you have to always be ready to stop it. I decided I wanted to block all emails from mail.ru from registering since they seem to be spam usually but I didn't know how to do that. So I figured I would track down a way and eventually found myself in the Joomla forums.
I discovered a post by SundanceKid on how to ban certain email domains from registering
. Thank you!
I modified it slightly so it didn't have yahoo or gmail in it. I also changed the error message below to be less obvious because I figured if they know its the email domain causing the error they will probably just try another one. But if they do this you can add another one to block by copying one of the lines in the middle of the code below and modifying it with the new domain.
Please post comments of any domains you find that are known to be spam and I will add it to the list for future use.
I was thinking that maybe there is some better way to do this by hooking it to some sort of database that probably already exists out there but this is good for now since all I really wanted to do is block mail.ru.
File: components/com_user/controller.php
Line: 266 (may differ per Joomla release)
// ##### BEGIN: SPAM DOMAIN FILTER #####
// Kick out spam domains
$email = $user->get('email');
if ( strpos($email,"gawab.com") ||
strpos($email,"mail.ru") ||
strpos($email,"list.ru") ||
strpos($email,"bk.ru") ||
strpos($email,"minivds.ru") ||
strpos($email,"nakgirls.ru") ||
strpos($email,"yandex.ru") ||
strpos($email,"info1a.cn") ||
strpos($email,"gooogletartsert.net") ||
strpos($email,"freemeilaadressforall.net") ||
strpos($email,"goodemailadressforfree.net") ||
strpos($email,"5opicforum.cn") ||
strpos($email,"pozitifff.com") ||
strpos($email,"2008bases1.net") ||
strpos($email,"nm.ru") ||
strpos($email,"goldwoof.net") ||
strpos($email,"megapochta.cn") ||
strpos($email,"meta.ua") ||
strpos($email,"fene4ek.net") ||
strpos($email,"mail15.com") ||
strpos($email,"googlemail.com") ||
strpos($email,"yandex.com") ||
strpos($email,"inmail24.com") )
{
JError::raiseWarning('','Error');
$this->register();
return false;
}
// ##### END: SPAM DOMAIN FILTER #####