[PHP] Loop though email list
I am a total newbie, so please forgive the simplicity! I have a huge list of email addresses in a text file and also in a MySQL DB that I would like to use PHP to loop through and send an email to each one of them. How do I loop through a text file using each email in the txt file as a seperate email address and send a message to that address? Or would it be easier to just do it from a MySQL DB? If so, How?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Loop though email list
With mysql: $connection = mysql_connect("host","user","pass"); $db = mysql_select_db("db_to_use", $connection); $sql = mysql_query("SELECT * FROM table ORDER BY email ASC"); while ($row = mysql_fetch_array($sql)) { $email = $row["email"]; $name = $row["name"]; email(EMAIL_FUNCTION_STUFF); } Tyler Longren Captain Jack Communications [EMAIL PROTECTED] www.captainjack.com On Tue, 14 Aug 2001 16:09:22 -0500 "Erich Kolb" <[EMAIL PROTECTED]> wrote: > I am a total newbie, so please forgive the simplicity! > > I have a huge list of email addresses in a text file and also in a MySQL > DB > that I would like to use PHP to loop through and send an email to each > one > of them. How do I loop through a text file using each email in the txt > file > as a seperate email address and send a message to that address? Or > would it > be easier to just do it from a MySQL DB? If so, How?? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Loop though email list
for a file i would do something like this: for the mysql db it would be something like this (this is probably a little off): I hope this helps. I'm sure it probably has a syntax error or something but you get the point. :-) Welcome to the happy world of php! - Dan On Tue, 14 Aug 2001, Erich Kolb wrote: > I am a total newbie, so please forgive the simplicity! > > I have a huge list of email addresses in a text file and also in a MySQL DB > that I would like to use PHP to loop through and send an email to each one > of them. How do I loop through a text file using each email in the txt file > as a seperate email address and send a message to that address? Or would it > be easier to just do it from a MySQL DB? If so, How?? > > > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]