0

I need to validate user input. The user can enter a full to header for an email message, so it may look like any of the following:

user@example.com
<user@example.com>
User <user@example.com>
"User" <user@example.com>
user@example.com, User2 <user2@example.com>

..etc. All of the above are valid To fields.

However, when user input is something like this:

user@example.com, not_an_email, User <user.example.com>

Then I want to respond with an error for the last 2 emails.

It's not a problem for me to check a plain email address for validity, but the extra String and braces <> I am a bit clueless about at the moment.

ragulka
  • 4,312
  • 7
  • 48
  • 73

0 Answers0