java:如何在不发送确认电子邮件的情况下验证电子邮件地址是否有效?

时间:2022-10-19 21:59:40

when people register to my website i don't want to send them a verification e-mail, i just want to check if that e-mail exists. is there a way to do such a thing ?

当人们注册到我的网站时,我不想给他们发一封验证邮件,我只是想看看那封邮件是否存在。有办法做这样的事吗?

using apache-tomcat and java as my main programming language.

使用apache-tomcat和java作为我的主要编程语言。

thanks a lot!

谢谢!

9 个解决方案

#1


9  

You can at highest use regex to check if the address is syntactically valid and/or looking up the MX records if the domain is valid, but this still does not guarantee that the email address is legitimate and belongs to the registrant in question. There is really no more reliable way than sending a verficiation email and waiting for confirmation in a short timespan.

您最多可以使用regex检查地址是否语法有效,如果域是有效的,可以查找MX记录,但这仍然不能保证电子邮件地址是合法的,并且属于相关的注册者。没有比发送一个verficiation电子邮件并在短时间内等待确认更可靠的方法了。

#2


15  

No. There is no way to tell if an email address points to a valid destination. You can check basic syntax, and that the domain has a record in DNS, but that's all.

不。无法判断电子邮件地址是否指向一个有效的目的地。您可以检查基本语法,域在DNS中有记录,但仅此而已。

#3


6  

I just wanted to weigh in and say that despite your reluctance to do so, PLEASE send an email and force the user to confirm that they have control of it before allowing that email address to be used in association with an account on your site. Why? Because not doing that, for any reason, means that users can sign up for accounts using email addresses that aren't theirs. They might do so accidentally, or they might do so very much on purpose (e.g., signing others up for accounts for any number of reasons); that's just not kosher, and websites that allow it are open to being reported to their ISPs.

我只是想说,尽管您不愿意这么做,但请发送一封邮件,并迫使用户在允许该电子邮件地址与您的站点上的一个帐户关联使用之前,确认他们对其拥有控制权。为什么?因为不这样做,无论出于什么原因,都意味着用户可以使用不属于自己的电子邮件地址注册账户。他们可能是无意中这么做的,或者他们可能是故意这么做的(例如,出于各种原因为他人注册账户);这是不符合犹太教规的,允许它的网站可以向他们的isp报告。

(I say this as the owner of a Gmail account which, at least two to three times a month, is signed up for an account at some website that doesn't force users to confirm their email addresses in this manner. It's irritating, and it puts the onus on me to get the account removed from the offending website. I've now taken to recovering any passwords I can, logging into the account, and then changing the email address to "SOMEDUMBFUCKDOESNTKNOWHISOWNEMAILADDRESS@gmail.com" or something like that... it's sorta fun, but I doubt you want this to happen on your website.)

(我说这是Gmail账户的所有人,每个月至少有两到三次,在某个网站上注册一个账户,不强迫用户以这种方式确认他们的电子邮件地址。这很让人恼火,也让我有责任把账号从网站上删除。现在我已经开始恢复我所能恢复的所有密码,登录到账户,然后把邮箱地址改成“somedumbfuckdoesntknocheckownemailaddress@gmail.com”或者类似的东西……这很有趣,但我怀疑你想在你的网站上发生。

#4


5  

contrary to some of the uneducated answers you can TRY and connect to an MX server and use the VRFY command to see if the sever supports it. Here is a website that will do this for you as an example. If you look at its exchange with the MX server it actually does try and send an email but does a RESET before actually sending it. Testing it with my email address works but I don't get an email. So yes you CAN do what everyone else is saying you can't do. Use an address you know works for your domain, then use one that you don't isn't supported. You will get a 550 on the last RCTP TO command. That is how you know it doesn't exist.

与一些没有受过教育的答案相反,您可以尝试连接到MX服务器并使用VRFY命令来查看服务器是否支持它。这是一个网站,它会为你做一个例子。如果你查看它与MX服务器的交换,它确实尝试发送电子邮件,但在实际发送之前做了重置。用我的电子邮件地址测试可以,但是我没有收到电子邮件。所以,你可以做别人说你做不到的事。使用一个你知道适合你的域名的地址,然后使用一个你不支持的地址。您将在最后一个RCTP命令中获得550。这就是你知道它不存在的原因。

#5


3  

This has been answered already in previous questions here. Without a verification email, the best you can do is look at the email address and look if it seems valid. You can also check things such as the domain, to see if it exists and has MX records. Anyway, see https://*.com/questions/3232/how-far-should-one-take-e-mail-address-validation and Using a regular expression to validate an email address

这已经在前面的问题中得到了回答。如果没有验证邮件,最好的办法就是查看邮件地址,看它是否有效。您还可以检查域之类的东西,以查看它是否存在并具有MX记录。无论如何,请参见https://*.com/questions/3232/how-far-should-one-take- mail-address-validation,并使用正则表达式来验证电子邮件地址

#6


1  

If you just want to verify that it LOOKs like a valid email address, there are many sample Regex's that will verify that. If you want to verify the user has control of the email address, you'll need to send something to it and craft a unique response to verify it.

如果您只是想验证它看起来像一个有效的电子邮件地址,有许多示例Regex将验证这一点。如果您想要验证用户对电子邮件地址的控制,您需要向它发送一些东西并设计一个惟一的响应来验证它。

#7


1  

i guess this is what you are looking for

我猜这就是你要找的

http://www.strikeiron.com/Catalog/ProductDetail.aspx?pv=5.0.0&pn=Email+Verification

http://www.strikeiron.com/Catalog/ProductDetail.aspx?pv=5.0.0&pn=Email +验证

#8


1  

You can use the openid service to check for valids email addresses as * does.

您可以像*那样使用openid服务检查验证电子邮件地址。

http://openid.net/

http://openid.net/

#9


0  

Email Verification services are very helpful in validating email address. Most of them performs 6 levels of verification like syntax validation, Domain MX record Check, Role based Account detection, Disposable email address (DEA) detection, HoneyPot/Spam track detection and deep level SMTP verification.

电子邮件验证服务对验证电子邮件地址非常有用。它们大多数执行6个级别的验证,如语法验证、域MX记录检查、基于角色的帐户检测、一次性电子邮件地址(DEA)检测、蜜罐/垃圾邮件跟踪检测和深度SMTP验证。

Most of them offers API integration, so, you can directly validate email addresses from your application.

它们大多数都提供API集成,因此,您可以直接验证来自应用程序的电子邮件地址。

#1


9  

You can at highest use regex to check if the address is syntactically valid and/or looking up the MX records if the domain is valid, but this still does not guarantee that the email address is legitimate and belongs to the registrant in question. There is really no more reliable way than sending a verficiation email and waiting for confirmation in a short timespan.

您最多可以使用regex检查地址是否语法有效,如果域是有效的,可以查找MX记录,但这仍然不能保证电子邮件地址是合法的,并且属于相关的注册者。没有比发送一个verficiation电子邮件并在短时间内等待确认更可靠的方法了。

#2


15  

No. There is no way to tell if an email address points to a valid destination. You can check basic syntax, and that the domain has a record in DNS, but that's all.

不。无法判断电子邮件地址是否指向一个有效的目的地。您可以检查基本语法,域在DNS中有记录,但仅此而已。

#3


6  

I just wanted to weigh in and say that despite your reluctance to do so, PLEASE send an email and force the user to confirm that they have control of it before allowing that email address to be used in association with an account on your site. Why? Because not doing that, for any reason, means that users can sign up for accounts using email addresses that aren't theirs. They might do so accidentally, or they might do so very much on purpose (e.g., signing others up for accounts for any number of reasons); that's just not kosher, and websites that allow it are open to being reported to their ISPs.

我只是想说,尽管您不愿意这么做,但请发送一封邮件,并迫使用户在允许该电子邮件地址与您的站点上的一个帐户关联使用之前,确认他们对其拥有控制权。为什么?因为不这样做,无论出于什么原因,都意味着用户可以使用不属于自己的电子邮件地址注册账户。他们可能是无意中这么做的,或者他们可能是故意这么做的(例如,出于各种原因为他人注册账户);这是不符合犹太教规的,允许它的网站可以向他们的isp报告。

(I say this as the owner of a Gmail account which, at least two to three times a month, is signed up for an account at some website that doesn't force users to confirm their email addresses in this manner. It's irritating, and it puts the onus on me to get the account removed from the offending website. I've now taken to recovering any passwords I can, logging into the account, and then changing the email address to "SOMEDUMBFUCKDOESNTKNOWHISOWNEMAILADDRESS@gmail.com" or something like that... it's sorta fun, but I doubt you want this to happen on your website.)

(我说这是Gmail账户的所有人,每个月至少有两到三次,在某个网站上注册一个账户,不强迫用户以这种方式确认他们的电子邮件地址。这很让人恼火,也让我有责任把账号从网站上删除。现在我已经开始恢复我所能恢复的所有密码,登录到账户,然后把邮箱地址改成“somedumbfuckdoesntknocheckownemailaddress@gmail.com”或者类似的东西……这很有趣,但我怀疑你想在你的网站上发生。

#4


5  

contrary to some of the uneducated answers you can TRY and connect to an MX server and use the VRFY command to see if the sever supports it. Here is a website that will do this for you as an example. If you look at its exchange with the MX server it actually does try and send an email but does a RESET before actually sending it. Testing it with my email address works but I don't get an email. So yes you CAN do what everyone else is saying you can't do. Use an address you know works for your domain, then use one that you don't isn't supported. You will get a 550 on the last RCTP TO command. That is how you know it doesn't exist.

与一些没有受过教育的答案相反,您可以尝试连接到MX服务器并使用VRFY命令来查看服务器是否支持它。这是一个网站,它会为你做一个例子。如果你查看它与MX服务器的交换,它确实尝试发送电子邮件,但在实际发送之前做了重置。用我的电子邮件地址测试可以,但是我没有收到电子邮件。所以,你可以做别人说你做不到的事。使用一个你知道适合你的域名的地址,然后使用一个你不支持的地址。您将在最后一个RCTP命令中获得550。这就是你知道它不存在的原因。

#5


3  

This has been answered already in previous questions here. Without a verification email, the best you can do is look at the email address and look if it seems valid. You can also check things such as the domain, to see if it exists and has MX records. Anyway, see https://*.com/questions/3232/how-far-should-one-take-e-mail-address-validation and Using a regular expression to validate an email address

这已经在前面的问题中得到了回答。如果没有验证邮件,最好的办法就是查看邮件地址,看它是否有效。您还可以检查域之类的东西,以查看它是否存在并具有MX记录。无论如何,请参见https://*.com/questions/3232/how-far-should-one-take- mail-address-validation,并使用正则表达式来验证电子邮件地址

#6


1  

If you just want to verify that it LOOKs like a valid email address, there are many sample Regex's that will verify that. If you want to verify the user has control of the email address, you'll need to send something to it and craft a unique response to verify it.

如果您只是想验证它看起来像一个有效的电子邮件地址,有许多示例Regex将验证这一点。如果您想要验证用户对电子邮件地址的控制,您需要向它发送一些东西并设计一个惟一的响应来验证它。

#7


1  

i guess this is what you are looking for

我猜这就是你要找的

http://www.strikeiron.com/Catalog/ProductDetail.aspx?pv=5.0.0&pn=Email+Verification

http://www.strikeiron.com/Catalog/ProductDetail.aspx?pv=5.0.0&pn=Email +验证

#8


1  

You can use the openid service to check for valids email addresses as * does.

您可以像*那样使用openid服务检查验证电子邮件地址。

http://openid.net/

http://openid.net/

#9


0  

Email Verification services are very helpful in validating email address. Most of them performs 6 levels of verification like syntax validation, Domain MX record Check, Role based Account detection, Disposable email address (DEA) detection, HoneyPot/Spam track detection and deep level SMTP verification.

电子邮件验证服务对验证电子邮件地址非常有用。它们大多数执行6个级别的验证,如语法验证、域MX记录检查、基于角色的帐户检测、一次性电子邮件地址(DEA)检测、蜜罐/垃圾邮件跟踪检测和深度SMTP验证。

Most of them offers API integration, so, you can directly validate email addresses from your application.

它们大多数都提供API集成,因此,您可以直接验证来自应用程序的电子邮件地址。