Verifying the domain of an e-mail addresse
There are two parties for an email addresse : the username and the domain name
username@domain
The domain part defines a set of associated machines in which it requires a server for sending emails. In the domain there are different users. However it is currently impossible to verify the validity of an email addresse. Moreover the DNS server can detect whether the domain address exist or not.
In order to make this kind of verification, it may limit to a least a minimum damage when for a user to submit his email address.
Some features of PHP enable a query for DNS server. There is one who has the advantage of being simple and adequate for what you want to do: checkdnsrr (). It takes as argument a domain name and return TRUE or FALSE as the field exists or not.
To test the validity of an addresse domain name, run the following:
$domain = explode('@', $email);
if (checkdnsrr($domain[1]))
echo "Domain for valid address";