Block junk emails, spammers and temporary emails

If you need an Email Validator Function, consider this version that includes also the check against common temporary mail services which should be blocked, since their emails work only for some minutes.
Temporary emails services are web sites that let you open an anonymous email account that works only for a session. They are used to activate temporary accounts, for example for test purposes, or to get a link when a subcription is required and sometimes for sending spam.
Those accounts, from a normal user point of view, can be useful. But as owner of a website, when you find those email in your db, they are just JUNK and you can delete them, since they don’t work.
So this function can help you stop junk accounts, spammers and fake users from your site.

function is_email($Address) { /* stop temporary accounts and email validation */
	if(stristr($Address,"@yopmail.com")) return false;
	if(stristr($Address,"@rmqkr.net")) return false;
	if(stristr($Address,"@emailtemporanea.net")) return false;
	if(stristr($Address,"@sharklasers.com")) return false;
	if(stristr($Address,"@guerrillamail.com")) return false;
	if(stristr($Address,"@guerrillamailblock.com")) return false;
	if(stristr($Address,"@guerrillamail.net")) return false;
	if(stristr($Address,"@guerrillamail.biz")) return false;
	if(stristr($Address,"@guerrillamail.org")) return false;
	if(stristr($Address,"@guerrillamail.de")) return false;
	if(stristr($Address,"@fakeinbox.com")) return false;
	if(stristr($Address,"@tempinbox.com")) return false;
	if(stristr($Address,"@guerrillamail.de")) return false;
	if(stristr($Address,"@guerrillamail.de")) return false;
	if(stristr($Address,"@opayq.com")) return false;
	if(stristr($Address,"@mailinator.com")) return false;
	if(stristr($Address,"@notmailinator.com")) return false;
	if(stristr($Address,"@getairmail.com")) return false;
	if(stristr($Address,"@meltmail.com")) return false;
	return preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$/i", $Address);

As you can see it’s very simple, it check for bad domains and then performs a normal email validation with regular expressions.


  1. Simone

    That’s cool but maintaining this list will be a real pain in the ass.
    Why don’t you create a public API with an updated list of all the domains to be considered “junk” and use your function to check against this db?