0

我有一个用户输入电子邮件地址的表单。我正在通过 java 脚本对其进行验证。我想验证电子邮件地址的域名 在 .net 中验证电子邮件地址的域名的最佳方法是什么?

4

3 回答 3

1

此 webservive 正在检查域: http: //www.eccoma.com/domain_webservice.aspx
您必须从电子邮件地址中将域名子串并发送到 webservice
通知:要测试此 webservive,您必须在线
运行示例代码:

protected void btnwhoIs_Click(object sender, EventArgs e)
{
try
{
Whois_Service service = new Whois_Service();
Whois whois = new Whois();

service.SoapVersion = SoapProtocolVersion.Soap12;
whois = service.GetWhois("DOM-T36309683M", "", txtWhoIs.Text);

divRes.InnerText = whois.Description;
}
catch (System.Net.WebException ex)
{
divRes.InnerText = ex.Message;
}

}
于 2013-05-22T03:58:13.280 回答
1

在电子邮件地址中检查域名的最佳方法是使用正则表达式此表达式用于验证电子邮件 \w+([-+.']\w+) @\w+([-.]\w+) .\w+([-.] \w+)* 您可以在此表达式中编辑域部分 \w+([-.]\w+)*\

于 2013-05-21T12:05:37.847 回答
0

As @KingCronus said, there's no good method built in the framework for doing this. The most reliable method I know of is using this commercial component: http://cobisi.com/email-validation/.net-component I've once done work using it for a client and it seemed reliable. You can use it to detect bogus email services (like http://mailinator.com/), but unfortunately, I don't know of any free component that performs this functionality.

于 2013-05-22T04:53:11.657 回答