问题
I'm developing a web application with Chat Support, and so far, I've been using JQuery validation to check whether the input text is a well formatted email address.
But that doesn't seem to fulfill its purpose.
For example:
- Entering a working and legitimate email address such as myname@gmail.com
- Entering a fake/random email address such as abcd@something.com
Both are accepted into the field as valid.
So is there any way to detect whether the specified email address exists or not in real-life, by using PHP (or any other) without sending the user, a click-to-confirm
email?
I've tried the SMTP method discussed in the other question, but unfortunately, the server returned error for all Email addresses, even legitimate ones. I think they have prevented enumeration for security purposes.
Any help would be greatly appreciated. :)
回答1:
No, it's not possible to reliably check if email address actually exists withotu sending an actual email. All you can do by yourself is to check syntax of email address and check of domain name exists.
To check email address syntax:
filter_var($email, FILTER_VALIDATE_EMAIL)
To check A and MX records:
checkdnsrr($domain,"MX") || checkdnsrr($domain,"A")
Next step is to send actual email with confirmation URL or confirmation code.
来源:https://stackoverflow.com/questions/34564281/checking-existence-of-email-address