所有有效的电子邮件都至少包含一个@符号吗?

Do all valid emails contain at least one @ symbol?

我不是想提出完整的电子邮件验证。我正在尝试防止特定问题:

我曾让用户使用我网站上的联系表单,该表单要求输入“Name”、“Email”和“Message”,结果出现了可笑的错误,我得到信息,“First Name”,“Last Name”,“Message”,我自己想,'Shit where did I leave my Yellow Pages?'

所以,我不想验证电子邮件,我只是想提醒人们,我们要的不是姓氏,而是电子邮件。

我想检查 @ 符号,我想确保我没有忽略有效的电子邮件。

是否有不含 @ 符号的有效电子邮件?

所有有效的电子邮件地址都包含@符号。您可以阅读 Internet 消息格式标准以获取更多信息:https://www.rfc-editor.org/rfc/rfc5322

特别是 3.4.1。 Addr-spec 规范:https://www.rfc-editor.org/rfc/rfc2822#section-3.4.1

如 RFC5322 第 3.4.1 节中所定义:

An addr-spec is a specific Internet identifier that contains a locally interpreted string followed by the at-sign character ("@", ASCII value 64) followed by an Internet domain.

https://www.rfc-editor.org/rfc/rfc5322

根据 RFC5322:

An addr-spec is a specific Internet identifier that contains a locally interpreted string followed by the at-sign character ("@", ASCII value 64) followed by an Internet domain.

所以,是的,所有电子邮件地址都必须具有 @ 字符。

在互联网接管世界之前, 电子邮件地址可能有其他格式,例如 FidoNet 邮件地址 1:170/918.10,用户编号 10 FidoNet 节点 1:170/918.

但考虑到互联网用户与 FidoNet 用户的比例目前大约为数亿或更多,这仅供参考。

今天,是(见其他答案);但历史答案是:没有。

原始标准 (RFC822 ff) 使极短、有效且有效的电子邮件地址成为可能,例如“i.me”。 (DDJ 曾经 运行 一场比赛。) @ 只是表示主机中的邮箱;因此,如果您拥有整个主机(例如,您自己的服务器或 PC),则不需要 @.

检查电子邮件地址的规则过去很复杂。为了稍微简化它们,并匹配许多损坏的“跳棋”的不良做法,最初无效的假设电子邮件地址将包含 @ 最终被纳入官方标准。

是的,根据 RFC5322,鉴于 local-name@domain.com...

的基本格式,每个电子邮件地址都必须有一个 at 符号

An addr-spec is a specific Internet identifier that contains a locally interpreted string followed by the at-sign character ("@", ASCII value 64) followed by an Internet domain.

但请确保不要只验证 一个 at 符号 ,因为一个电子邮件地址可能有多个。毕竟还有其他的RFC!

RFC2822 使我们能够在电子邮件地址中使用带引号的字符串...

3.2.2. Quoted characters

Some characters are reserved for special interpretation, such as delimiting lexical tokens. To permit use of these characters as uninterpreted data, a quoting mechanism is provided.

quoted-pair = ("" text) / obs-qp

所以 "@"@gmail.com 是一个有效的电子邮件地址。

也不要忘记 RFC5321!这定义了另一个基本过程,可以在您的电子邮件地址中包含任意数量的 @ 符号...

Note that the backslash, "\", is a quote character, which is used to indicate that the next character is to be used literally (instead of its normal interpretation). For example, "Joe\,Smith" indicates a single nine-character user name string with the comma being the fourth character of that string.

那么,\@@gmail.com 也是一个技术上有效的电子邮件地址。