检查电子邮件地址的存在 [英] Checking existence of email address

查看:84
本文介绍了检查电子邮件地址的存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发带有聊天支持的Web应用程序,到目前为止,我一直在使用JQuery验证来检查输入文本是否为格式正确的电子邮件地址.

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.

例如:

  1. 输入有效的合法电子邮件地址,例如 myname@gmail.com
  2. 输入伪造/随机的电子邮件地址,例如 abcd@something.com

这两个字段均被接受为有效字段.

Both are accepted into the field as valid.

因此,有任何方法可以通过使用PHP(或任何其他方法)来检测现实中指定的电子邮件地址是否存在,而无需向用户发送 click-to-confirm 电子邮件?

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. :)

推荐答案

否,在发送实际电子邮件时无法可靠地检查电子邮件地址是否确实存在.您唯一可以做的就是检查电子邮件地址的语法并检查域名是否存在.

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)

要检查A和MX记录,请执行以下操作:

To check A and MX records:

checkdnsrr($domain,"MX") || checkdnsrr($domain,"A")

下一步是发送带有确认URL或确认代码的实际电子邮件.

Next step is to send actual email with confirmation URL or confirmation code.

这篇关于检查电子邮件地址的存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆