2011-01-23 113 views

回答

2

您應該使用MailAddress類:

MailAddress address = null; 
try { 
    address = new MailAddress(str); 
} catch(FormatException) { 
    //Invalid address 
} 
if (!address.Host.Equals("microsoft.com", StringComparison.OrdinalIgnoreCase) { 
    //Bad domain 
} 
+0

感謝我怎麼這個功能在MVC與數據註解連接到典型的模式? – Francesco 2011-01-23 22:03:24