当前位置: 移动技术网 > IT编程>开发语言>PHP > php编写的一个E-mail验证类

php编写的一个E-mail验证类

2018年06月25日  | 移动技术网IT编程  | 我要评论

这个类可以用来检查电子邮件是否有效使用smtp协议。

它可以连接到由地址的域名来验证的mx记录中定义的smtp服务器。

并且模拟消息的传递,以查看是否在给定的收件人地址被接受为有效。

<!doctype html public "-//w3c//dtd html 4.01 transitional//en">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>sample</title>
  </head>
  <body>
    <?php
    //www.codepearl.com
    include_once 'class.verifyemail.php';
 
    $email = 'verify@codepearl.com';
 
    $vmail = new verifyemail();
 
    if ($vmail->check($email)) {
      echo 'email <' . $email . '> exist!';
    } elseif ($vmail->isvalid($email)) {
      echo 'email <' . $email . '> valid, but not exist!';
    } else {
      echo 'email <' . $email . '> not valid and not exist!';
    }
    ?>
  </body>
</html>

以上所述就是本文给大家分享的全部内容了,希望对大家熟练掌握php能够有所帮助。

请您花一点时间将文章分享给您的朋友或者留下评论。我们将会由衷感谢您的支持!

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网