fork(2) download
  1. using System;
  2. using System.Net.Mail;
  3.  
  4. namespace EmailTest
  5. {
  6. class Program
  7. {
  8. public static void Main(string[] args)
  9. {
  10. WriteInfo("email@domain.com");
  11. WriteInfo("Name<email@domain.com>");
  12. WriteInfo("Name <email@domain.com>");
  13. }
  14.  
  15. private static void WriteInfo(string email)
  16. {
  17. MailAddress address = new MailAddress(email);
  18. Console.WriteLine("'{0}' =", email);
  19. Console.WriteLine(" DisplayName = '" + address.DisplayName + "'");
  20. Console.WriteLine(" Address = '" + address.Address + "'");
  21. Console.WriteLine(" User = '" + address.User + "'");
  22. Console.WriteLine(" Host = '" + address.Host + "'");
  23. }
  24. }
  25. }
Success #stdin #stdout 0.04s 37168KB
stdin
Standard input is empty
stdout
'email@domain.com' =
   DisplayName = ''
   Address = 'email@domain.com'
   User = 'email'
   Host = 'domain.com'
'Name<email@domain.com>' =
   DisplayName = 'Name'
   Address = 'email@domain.com'
   User = 'email'
   Host = 'domain.com'
'Name <email@domain.com>' =
   DisplayName = 'Name'
   Address = 'email@domain.com'
   User = 'email'
   Host = 'domain.com'