using System;
using System.Net.Mail;
namespace EmailTest
{
class Program
{
public static void Main(string[] args)
{
WriteInfo("email@domain.com");
WriteInfo("Name<email@domain.com>");
WriteInfo("Name <email@domain.com>");
}
private static void WriteInfo(string email)
{
MailAddress address = new MailAddress(email);
Console.WriteLine("'{0}' =", email);
Console.WriteLine(" DisplayName = '" + address.DisplayName + "'");
Console.WriteLine(" Address = '" + address.Address + "'");
Console.WriteLine(" User = '" + address.User + "'");
Console.WriteLine(" Host = '" + address.Host + "'");
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uTmV0Lk1haWw7CgpuYW1lc3BhY2UgRW1haWxUZXN0CnsKCWNsYXNzIFByb2dyYW0KCXsKCQlwdWJsaWMgc3RhdGljIHZvaWQgTWFpbihzdHJpbmdbXSBhcmdzKQoJCXsKCQkJV3JpdGVJbmZvKCJlbWFpbEBkb21haW4uY29tIik7CgkJCVdyaXRlSW5mbygiTmFtZTxlbWFpbEBkb21haW4uY29tPiIpOwoJCQlXcml0ZUluZm8oIk5hbWUgPGVtYWlsQGRvbWFpbi5jb20+Iik7CgkJfQoJCQoJCXByaXZhdGUgc3RhdGljIHZvaWQgV3JpdGVJbmZvKHN0cmluZyBlbWFpbCkKCQl7CgkJCU1haWxBZGRyZXNzIGFkZHJlc3MgPSBuZXcgTWFpbEFkZHJlc3MoZW1haWwpOwoJCQlDb25zb2xlLldyaXRlTGluZSgiJ3swfScgPSIsIGVtYWlsKTsKCQkJQ29uc29sZS5Xcml0ZUxpbmUoIiAgIERpc3BsYXlOYW1lID0gJyIgKyBhZGRyZXNzLkRpc3BsYXlOYW1lICsgIiciKTsKCQkJQ29uc29sZS5Xcml0ZUxpbmUoIiAgIEFkZHJlc3MgPSAnIiArIGFkZHJlc3MuQWRkcmVzcyArICInIik7CgkJCUNvbnNvbGUuV3JpdGVMaW5lKCIgICBVc2VyID0gJyIgKyBhZGRyZXNzLlVzZXIgKyAiJyIpOwoJCQlDb25zb2xlLldyaXRlTGluZSgiICAgSG9zdCA9ICciICsgYWRkcmVzcy5Ib3N0ICsgIiciKTsKCQl9Cgl9Cn0=