I would like to know of the possible ways to block disposable email addresses from registering in my website.
For simplicity, let\'s take the example where the regi
You can make two checks: spamhaus sbl query and your own list of blacklisted domains. Something like this:
private static function __emailDomainCheck($email)
{
$domain = preg_replace('/^.*@(.*)/', '$1', $email);
$blacklisted = Database::q('SELECT * FROM ' . Database::T('email_domain_blacklist') . ' WHERE domain = ?', array($domain));
if($blacklisted->rowCount() > 0)
return "This email domain is blacklisted!";
$host = gethostbyname($domain);
$rbl = 'sbl-xbl.spamhaus.org';
$rev = array_reverse(explode('.', $host));
$lookup = implode('.', $rev) . '.' . $rbl;
if ($lookup != gethostbyname($lookup))
{
return "Mail host is listed in $rbl!";
}
return '';
}