Check if email is hosted by gmail in PHP -
i need check if given email if hosted google.com or googlemail.com right check if ends on @gmail.com or @googlemail.com, method doesn't work emails, since google provides it's functionality external services, , emails can end on @abc.edu
how can run dns query on mx record find email hosted google?
use dns_get_record()
function is_google_mx($host) { $records = dns_get_record($host, dns_mx); foreach ($records $record) { if (substr(strtolower($record['target']), -11) == '.google.com') return true; if (substr(strtolower($record['target']), -15) == '.googlemail.com') return true; } return false; }
Comments
Post a Comment