简体   繁体   English

C#中的电子邮件存在检查

[英]E-Mail Existence Check in C#

I want to verify whether an e-mail is real or not. 我想验证电子邮件是否真实。 Some body told me I could do it with DNS check but I don't know how to do this. 有些人告诉我,我可以用DNS检查来做,但我不知道该怎么做。

Could somebody help me through this problem and I am developing with C#. 有人可以帮我解决这个问题吗?我正在用C#开发。

Thanks in advance. 提前致谢。

I guess this code-project article gives you the information you want: Effective Email Address Validation 我想这段代码项目文章为您提供了所需的信息: 有效的电子邮件地址验证

But even if you confirm that a domain is valid, it is still not guaranteed that the email address/recipient is valid. 但即使您确认域名有效,仍无法保证电子邮件地址/收件人有效。 Eg "xyz@stackoverflow.com" -> the domain is valid, but "xyz" might not be a valid email address. 例如“xyz@stackoverflow.com” - >域名有效,但“xyz”可能不是有效的电子邮件地址。

You can use DNS to determine if a domain is valid/resolving. 您可以使用DNS来确定是否有效/正在解析。 That wouldn't necessarily mean that a given email address at that domain is valid. 这并不一定意味着该域的给定电子邮件地址有效。 The only way to know that is to open an SMTP connection and try to send mail to that user. 知道这一点的唯一方法是打开SMTP连接并尝试向该用户发送邮件。

从来没有这样做过,但这里似乎有一个非常好的C#演练

DNS check would imply parsing out the domain attached to the email address in question and making sure it resolves/exists. DNS检查意味着解析附加到相关电子邮件地址的域并确保其解析/存在。

Be aware that checking that the domain resolves/exists could take time since your application would need to wait for a response from whatever service you use to check if it exists. 请注意,检查域解析/存在可能需要一些时间,因为您的应用程序需要等待您使用的任何服务的响应,以检查它是否存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM