PHP verifies that the email address is valid and correct.

Source: Internet
Author: User
PHP verifies that the email address is correct. (1) only applicable to Mainland China (2) Only the mainstream email address is limited and mandatory. In fact, there is no need to allow registration in all mailboxes, because many people Submit fake mailboxes and use the system to send emails automatically, which will occupy a lot of resources because the recipient's address does not exist. (3) If the server supports checkdnsrr, you can

PHP verifies that the email address is correct. (1) only applicable to Mainland China (2) Only the mainstream email address is limited and mandatory. In fact, there is no need to allow registration in all mailboxes, because many people Submit fake mailboxes and use the system to send emails automatically, which will occupy a lot of resources because the recipient's address does not exist. (3) If the server supports checkdnsrr, you can

PHP verifies that the email address is correct.

(1) Applicable only to Mainland China

(2) only mainstream email addresses are limited. In fact, there is no need to allow registration in all mailboxes, because many people Submit fake mailboxes and use the system to send emails automatically, which will occupy a lot of resources because the recipient's address does not exist.

(3) If the server supports checkdnsrr, it can be used, but it is not necessary to use it if mainstream mailboxes are already limited.

(4) we recommend that you use QQ mail or 163 mail.


    function CheckEmail($email)    {        global $dArr;        $dArr = array(        '163.com','126.com','sina.com','yahoo.com.cn','yahoo.com','sohu.com','yeah.net','139.com',        'tom.com','21cn.com','qq.com','foxmail.com','gmail.com','hotmail.com','263.net',        'vip.qq.com','vip.163.com','vip.sina.com','vip.sina.com.cn','vip.foxmail.com',        );        if(empty($email)) return FALSE;        list($e,$d) = explode('@', $email);        if(!empty($e) && !empty($d))        {            $d = strtolower($d);            if(!in_array($d,$dArr)) return FALSE;            return preg_match('/^[a-z0-9]+([\+_\-\.]?[a-z0-9]+)*/i', $e);        }        return FALSE;    }

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.