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:
[email protected]
<[email protected]>
User <[email protected]>
"User" <[email protected]>
[email protected], User2 <[email protected]>
..etc. All of the above are valid To fields.
However, when user input is something like this:
[email protected], 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.