Import emails from a string
<p>I would like to let my users paste a string of emails into a text are and on submit import them into a db table.</p>

<p>It seem that the typical syntax for email and they way it is usually typed in TO field is:</p>

<pre><code>"Fname Lname" &lt;abc@email.com&gt;, "Fname Lname" &lt;abc@gmail.com&gt;,
</code></pre>

<p>I suppose on submit I need to parse it through some loop. How do I detect the name/email pair break? Is there a way to also do some basic email validation? </p>

<hr>

<p>UPDATE:</p>

<p>I realized that sometimes the string can be slightly off, like missing a name:</p>

<pre><code>Fname Lname" &lt;abc@email.com&gt;, abc@gmail.com,
</code></pre>

<p>or even</p>

<pre><code>&lt;abc@email.com&gt;, abc@gmail.com,
</code></pre>

<p>or even</p>

<pre><code>abc@email.com, abc@gmail.com,
</code></pre>

<p>How to make it more robust and note break if a name is missing? The email should be there all the time! Otherwise it just needs to ignore an instance and move on to the next contact. But I guess I can do that validation after the array of contacts is created...</p>
