This topic is locked

Group emails

5/8/2009 8:47:00 AM
PHPRunner General questions
S
swanside author

Hello.

I have a table with login details which hold email address.
How can I send out a group email to everybody from this table?

Thanks

Sergey Kornilov admin 5/8/2009

Here is the code snippet you can use:

$subject = "";

$message = "";

$toAddr = "";

$sql = SELECT DISTINCT email FROM members;

$result = mysql_query($sql);

while ($row = mysql_fetch_row($result))

{

$toAddr .= "$row[0]";

mail($toAddr,$subject,$message);

}