Created
July 11, 2018 04:03
-
-
Save yudaprawira/1fcc215a841617ed4d0ea71b4f184640 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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