Home >Backend Development >PHP Tutorial >An E-mail verification class written in PHP_PHP tutorial

An E-mail verification class written in PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:00:151276browse

An E-mail verification class written in PHP

This article mainly introduces the usage of an E-mail verification class written in PHP. It is very simple and practical, and requires little effort. For reference, you can take it away and use it directly.

This class can be used to check if an email is valid using the SMTP protocol.

It can connect to SMTP servers defined in the MX records verified by the domain name of the address.

And simulate the delivery of a message to see if it is accepted as valid at a given recipient address.

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

Sample

//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!';

}

?>

1 2

3

4 5

67 8 9 10 11 12
13
14
15 16 17 18 19 20 21 22 23 24 25
Sample <🎜>//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!'; } ?>
The above is all the content shared with you in this article. I hope it will be helpful to everyone to become proficient in PHP. http://www.bkjia.com/PHPjc/973925.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/973925.htmlTechArticleAn E-mail verification class written in php. This article mainly introduces an E-mail verification class written in php. The usage is very simple and practical. If you need it, you can take it and use it directly...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn