If you have any questions please contact me: http://www.webjx.com web@webjx.com
Reprint please indicate the source
When you register on a forum, there is usually an e-mail address verification function, when you enter an illegal format, there will be some kind of error message.
We can use the following rule expression
Ereg ("^[a-za-z0-9_]+@[a-za-z0-9\-]+\.[ A-za-z0-9\-\.] +$] ", $email);
But the function of the above equation is to check only strings and not output. We can further use this formula to achieve the function of returning information:
if (eregi ("^[a-za-z0-9_]+@[a-za-z0-9\-]+\.[ A-za-z0-9\-\.] +$] ", $email)
{
return FALSE;
}
Here we can go further to detect the host name, does it exist:
List ($username, $domain) = Split ("@", $email);
if (GETMXRR ($domain, $mxhost))
{
return TRUE;
}
Else
{
if (Fsockopen ($domain, $errno, $errstr, 30))
{
return TRUE;
}
Else
{
return FALSE;
}
}
Now we'll organize the top two features in PHP to form a function:
function Checkemail ($email)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.