如何从电子邮件地址获取域名 [英] how to take domain from email address
本文介绍了如何从电子邮件地址获取域名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要这样做,我有一个具有不同域名的电子邮件地址.因此,如果一封电子邮件包含.in,则它将被重定向到与.com和.net相同的.in域.
所以我该如何使用查询或其他方式搜索域...
谢谢......
Mitesh
i want to do that i have email address with different domain name. so if one email consist .in so it will be redirect to .in domain same as .com and .net.
so how can i search the domain using query or else...
Regardsss....
Mitesh
推荐答案
您严重找不到此 ^ ]
You seriously couldn''t find this String.IndexOf[^]
由于,Local
部分和Domain
部分中允许使用.s
,如此处所述
http://en.wikipedia.org/wiki/Email_address#Valid_email_addresses [
Since,.s
are allowed inside theLocal
part andDomain
part of
http://en.wikipedia.org/wiki/Email_address#Valid_email_addresses[^]
the following statement can be used to extract the domain name
string emailAddress = @"some.name@yahoo.co.in";
string domainName = emailAddress.Substring(emailAddress.IndexOf('.',emailAddress.LastIndexOf('@')));
Console.WriteLine (domainName);
//.co.in
如果仅在此处说明顶级域名
http://en.wikipedia.org/wiki/Domain_Name [
If only the top level domain name explained here
http://en.wikipedia.org/wiki/Domain_Name[^] is required then
string domainName = emailAddress.Substring(emailAddress.LastIndexOf('.'));
Console.WriteLine (domainName);
//.in
可以使用.
can be used.
这篇关于如何从电子邮件地址获取域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文