正则表达形式电子邮件验证不起作用 [英] Regular expression form email validation not working

查看:110
本文介绍了正则表达形式电子邮件验证不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用RE验证EmailID。除了在点之后添加的域名外,它仅验证emailID。



即如果我输入emailID info@abc.2323,即使我输错了,这仍然有效/无效域名。



如何验证存在有效域名的电子邮件ID。



提前致谢...

Trying to validate EmailID with RE. It validates emailID only except domain name added after "dot".

i.e. if I put emailID info@abc.2323, this still works, even though I have entered wrong/invalid domain.

How can I validate email id against valid domains exist.

Thanks in advance...

推荐答案

您可以对域进行ping操作以查看它是否存在,但是可以使用不公开显示的域的电子邮件地址。



最好的方法是让用户添加他们喜欢的任何东西,但是向帐户发送身份验证电子邮件进行确认。



这只有在电子邮件有自己的情况下才有效。



您收到地址未找到的回复后,您还可以标记错误的电子邮件地址。



可以肯定的是,没有100%的银弹。最佳方法取决于您的具体需求
You could ping the domain to see if it exists, but it is possible to have an email address with a domain that is not publicly visible.

The best way is to let the user add anything they like but send an authentication email to the account to confirm it.

This will only work if the email is there own.

You could also flag bad email addresses after you have received a address-not-found response.

To be sure, there is no 100% silver bullet. The best method depends on your specific needs


除了解决方案1:另请参阅 https:/ /en.wikipedia.org/wiki/Email_tracking [ ^ ]。



底线是:这一切仅适用于自愿同意支持一种或另一种跟踪方式的邮件代理。因此,在实践中,您只能根据相互协议,与您的组织或某些业务合作伙伴一起执行此操作。通常,不支持任何方法,因为它会增加垃圾邮件的级别。



-SA
In addition to Solution 1: see also https://en.wikipedia.org/wiki/Email_tracking[^].

The bottom line is: this all works only for mail agents which voluntarily agree to support one or another way of tracking. So, in practice, you can do it only withing your organization or perhaps with some of your business partners, based on mutual agreements. Typically, no method are really supported, because it would increase the level of spamming.

—SA


您只能验证文本是否为something@something.something,您无法验证电子邮件本身是否有效或域是否有效。你最好不要对电子邮件进行任何验证,你最终会拒绝真正的地址,因为它们与你的正则表达式不匹配。验证地址有效的唯一方法是向其发送一封电子邮件,其中包含用户需要点击的验证链接,说明地址是真实的。
You can only validate the text is of the something something@something.something, you can't verify if the email itself is valid or the domains are valid. You're better off not doing any validation on the email at all, you'll only end up rejecting addresses that are genuine because they don't match your regex. The only way to verify the address is valid is to send it an email with a validation link the user needs to click on to say the address is real.


这篇关于正则表达形式电子邮件验证不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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