EmailAddressAttribute在末尾允许点 [英] EmailAddressAttribute allow dot on the end

查看:148
本文介绍了EmailAddressAttribute在末尾允许点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

EmailAddressAttribute允许在末尾加点。
这意味着以下电子邮件地址:someone@google.com。已验证。
对于Microsoft,此电子邮件有效。
但是,例如,对于PayPal,电子邮件是无效的。

EmailAddressAttribute in .NET 4.6.1 allow dot on the end. That means that following email: someone@google.com. is valid. For Microsoft this email is valid. But, for example, for PayPal, email is not valid.

所以有人知道,电子邮件末尾的点是否有效?

So does anybody know, is dot on the end of email valid or not?

推荐答案

关于这是否合法,存在很多竞争性信息。这是两种不同的观点,我将尝试解释一下原因。

There is a lot of contending information about whether this is legal, or valid. Those are two different views, and I'm going to try and explain a bit why.

电子邮件地址的一部分由 RFC 5322-Internet邮件格式,其中详细说明了电子邮件格式。

Email addresses are described in part by RFC 5322 - Internet Message Format which explains email formats in excruciating detail.

3.4.1-地址规范中,电子邮件地址格式说明。为了简洁起见,我的意思是:

In section 3.4.1 - Addr-spec, the email address format is explained. I'm paraphrasing for brevity but the general format is:


local-part @ domain

local-part@domain

将本地名称描述为以下点原子/带引号的字符串/ obs-local-part 和域之一描述为 dot-atom / domain-literal / obs-domain

With local-name described as one of the following dot-atom / quoted-string / obs-local-part and domain described as dot-atom / domain-literal / obs-domain.

因此,这是一个域名,即 RFC 1034-域名-概念和设施中进行了描述。

So it's a domain name, which is described in RFC 1034 - Domain Names - Concepts And Facilities.

域名可以是模棱两可的,也可以由结尾点的不存在来定义。不保证模棱两可的域名可以解析到一个位置,但是大多数(如果不是全部的话)DNS搜索列表会在幕后附加一个句号(如果不存在的话),但这是生活质量的提高。明确的域名必须包含一个后缀,基本上是DNS中的终止字符。

A domain name can be ambiguous or unambiguous, which is defined by the absence or presence of the trailing dot. Ambiguous domain names are not guaranteed to resolve to a location, but most (if not all at this point) DNS search lists append a period behind the scenes if one is not present, but this is a Quality-of-Life improvement. Unambiguous domain names must contain a trailing period, it's basically a terminating character in DNS.

Thomas Flinkow已经提到了源代码的样子,我只想提供一些上下文作为为什么-从历史上讲-正则表达式可能就是这样。尾随期是合法的,但有效性由邮件提供商定义。

Thomas Flinkow already mentioned what the source looks like, I just wanted to give some context as to why - historically - the regex might be the way it is. A trailing period is legal, but validity is defined by the mail providers.

这篇关于EmailAddressAttribute在末尾允许点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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