Skip to content

Instantly share code, notes, and snippets.

@harisenbon
Created September 5, 2014 00:18
Show Gist options
  • Select an option

  • Save harisenbon/84af1022cc49340186f8 to your computer and use it in GitHub Desktop.

Select an option

Save harisenbon/84af1022cc49340186f8 to your computer and use it in GitHub Desktop.
Detect if domain uses Gapps for email
<?php
// Determine if this is a Google-hosted account
$isGoogle = false;
if(!empty($_GET['inf_field_Email'])){
list($name, $domain) = explode('@', urldecode($_GET['inf_field_Email']));
if($domain == 'gmail.com'){
$isGoogle = true;
} elseif(getmxrr($domain, $mxHosts)){
foreach($mxHosts as $mx){
if(stripos($mx, 'google') !== false){ $isGoogle = true; }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment