Skip to content

Instantly share code, notes, and snippets.

@yudaprawira
Created July 11, 2018 04:03
Show Gist options
  • Save yudaprawira/1fcc215a841617ed4d0ea71b4f184640 to your computer and use it in GitHub Desktop.
Save yudaprawira/1fcc215a841617ed4d0ea71b4f184640 to your computer and use it in GitHub Desktop.
<?php
/**
* @author yuda KLN
* @copyright 2018
*/
echo isGmail('email@domain.com') ? 'google mail' : 'not';
function isGmail($email)
{
if ( filter_var($email, FILTER_VALIDATE_EMAIL) )
{
$domain = explode('@',$email)[1];
$hosts = array();
getmxrr($domain, $hosts);
foreach( $hosts as $h )
{
if ( strpos(strtolower($h), 'google.com') )
{
return true;
}
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment