我正在尝试检测电子邮件的目的地是否是数据库中的某个人。问题是存在等效的电子邮件,因此直接比较不会捕获所有情况。一些例子:foobar@gmail.com
== foo.bar@gmail.com
== foobar+123@gmail.com
。是否在某个地方定义了这些模式?
2 回答
What you are referencing is "Subaddressing Samantics"
As far as most people are concerned: No, there aren't any additional rules you are not aware of. This is because both the "." and "+/-" are domain-specific identifiers.
Gmail chose to recongize emails with dots the same as those without, e.g. JohnSmith@gmail.com == John.Smith@gmail.com, because it makes it too easy for imposters. Therefore, we are guaranteed that all Gmail addresses will be the same with or without dots, but this guarantee does not extend to every other domain.
如果您的意思是问是否有一种仅从名称来决定这一点的通用方法,那么没有。即使您使用模式来查找相似的电子邮件地址,您如何知道它们属于同一个人?也许 foobar123 真的与 foobar 不同?
现在,如果您的数据库表有链接到人员的电子邮件地址,您可以使用查询来查找与他们链接的人员并进行比较。
我唯一能想到的另一件事是您是否可以对电子邮件地址进行 IP 查找,但这样做存在很多问题。