通过验证但被退回的电子邮件地址是否有效?
我使用 Zend_Validate_EmailAddress 来验证我的电子邮件程序的电子邮件地址。它根据 RFC2822 进行验证 - http://framework.zend.com/ Manual/en/zend.validate.set.html
我的问题是这些电子邮件通过验证后是否有效?
[电子邮件受保护]。 [电子邮件受保护]。等等 注意最后的句号。
我发现验证器传递的这些电子邮件地址显然是错误的。我不完全明白为什么这会过去,有人可以帮助我吗?
问候
I use the Zend_Validate_EmailAddress to validate email addresses for my email program. It validates according to the RFC2822 - http://framework.zend.com/manual/en/zend.validate.set.html
My question is are these valid emails when they pass validation?
[email protected].
[email protected]. etc Note the full stop at the end.
I find that the validator passes these email addresses which are obviously wrong. I don't fully understand why this should pass can anyone help me?
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
电子邮件地址并非“明显错误”;而是“明显错误”。 DNS 名称允许以
.
结尾,以表明它是绝对的而不是相对的。[编辑补充:以上内容可能会产生误导。在电子邮件地址中,至少对于 SMTP,主机名始终被解释为完全限定的 — 即“绝对”。因此,电子邮件地址的主机名部分永远不需要尾随
.
。但是,尾随的.
仍然是有效的主机名语法。]The email addresses are not "obviously wrong"; a DNS name is allowed to end with a trailing
.
to indicate that it's absolute rather than relative.[EDITED to add: The above may be misleading. In an email address, for SMTP at least, hostnames are always interpreted as fully-qualified -- i.e., "absolute". So there's never a need for a trailing
.
in the hostname part of an email address. However, the trailing.
is still valid hostname syntax.]以下是 rfc2822 推荐的正则表达式:
这个正则表达式很耗时,因此我相信 Zend 使用了一个更简单的正则表达式,它无意中忽略了尾随的句号。
有用的链接:
http://www.regular-expressions.info/email.html
http://regexpal.com/
Following is the regular expression that is recommended by rfc2822 :
This regex is time-consuming therefore I believe that Zend went with a simpler regex which unintentionally ignores the trailing fullstop.
Helpful links:
http://www.regular-expressions.info/email.html
http://regexpal.com/