Note: You can go another step by splitting by @, taking the last part, and checking to see if the domain resolves. Dont’ check for MX servers – if there are no MX severs listed, the RFC says to use the hostname itself. See: http://php.net/getmxrr