mailaddress

How to parse formatted email address into display name and email address?

好久不见. 提交于 2021-02-07 05:09:03
问题 Given the email address: "Jim" <jim@example.com> If I try to pass this to MailAddress I get the exception: The specified string is not in the form required for an e-mail address. How do I parse this address into a display name (Jim) and email address (jim@example.com) in C#? EDIT: I'm looking for C# code to parse it. EDIT2: I found that the exception was being thrown by MailAddress because I had a space at the start of the email address string. 回答1: If you are looking to parse the email

How to parse formatted email address into display name and email address?

会有一股神秘感。 提交于 2021-02-07 05:06:28
问题 Given the email address: "Jim" <jim@example.com> If I try to pass this to MailAddress I get the exception: The specified string is not in the form required for an e-mail address. How do I parse this address into a display name (Jim) and email address (jim@example.com) in C#? EDIT: I'm looking for C# code to parse it. EDIT2: I found that the exception was being thrown by MailAddress because I had a space at the start of the email address string. 回答1: If you are looking to parse the email