PHPMailer Pro To Manage a Mailing List?
<p>PHPMailer Pro can manage your email address list. </p> <p>Email addresses can be entered in a considerable number of ways.</p> <p>Consider for example, a string:</p> <pre><code>$email = "Andy Prevost <a1ndy@example.com>,Jake The Fatman jake@example.net,peter.pan@example.org Peter Pan";</code> </pre> <p>And then, an array:</p> <pre><code>$email[] = "Andy Prevost <a1ndy@example.com>";<br> $email[] = ["Andy Prevost" => "a2ndy@example.com"];<br> $email[] = ["a3ndy@example.com" => "Andy Prevost"];<br> $email[] = ["Andy Prevost"];<br> $email[] = ["a4ndy@example.com"];<br> $email[] = "Andy Prevost";<br> $email[] = "a5ndy@example.com";<br></code></pre> <p>You should note some of these are not valid as email addresses.</p> <p>The goal is to get all of these email addresses into an acceptable RFC format (RFC 5322) with the name displayed first followed by the email address (with tokens) as in: <br> Sample Name <sample.name@example.com></p> <p>PHPMailer Pro can "parse" a mailing list in almost any format into an RFC 5322 compliant string. About the only restriction is that what you submit has to be either a string (as in the first example) or an array (as in the second example). You can, however, concatenate. If you process the first example and store it into a variable, you can then process the second example and append it to the same variable.</p> <p>That would look like:</p> <pre><code>$email = "Andy Prevost <a1ndy@example.com>,Jake The Fatman jake@example.net,peter.pan@example.org Peter Pan";<br>$mailing_list = $mail->Email_Format_RFC($email);<br>$email[] = "Andy Prevost <a1ndy@example.com>";<br>$email[] = ["Andy Prevost" => "a2ndy@example.com"];<br>$email[] = ["a3ndy@example.com" => "Andy Prevost"];<br>$email[] = ["Andy Prevost"];<br>$email[] = ["a4ndy@example.com"];<br>$email[] = "Andy Prevost";<br>$email[] = "a5ndy@example.com";<br>$mailing_list .= $mail->Email_Format_RFC($email);<br> </code> </pre> <p>At this point, we can exit. The goal was to get an RFC compatible mailing list, we've done that. </p><p>We can further post-process and get that list back into a database. </p>