Php checks whether the email address exists

Source: Internet
Author: User

In php, there is such a function checkdnsrr to verify that dns can be accessed to check whether the email address exists.
*/

The code is as follows: Copy code

$ Email = "abc@111cn.net ";
$ Check_email = checkdnsrr ($ email, "");

If ($ check_email ){

Return true;

} Else {

Return false;

}


/*
Checkdnsrr function description

Bool checkdnsrr (string $ host [, string $ type = "mx"])

Checkdnsrr. Check the dns record of the specified URL

<? Php

The code is as follows: Copy code

// This will not work
If (checkdnsrr ("round-robin-example.com"), "all ")){
Return true;
} Else {
Return false;
}

// But every value other than "any" will work
If (checkdnsrr ("round-robin-example.com"), "")){
Return true;
} Else {
Return false;
}

The specified host can be a network address or a machine name ). The type parameter can be omitted. The internal value is mx. The value of type can be one of the following: a, mx, ns, soa, ptr, cname, or any. If the dns field of the specified URL is found, true is returned. If the specified dns field is not found or an error occurs, false is returned.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

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.