<?php
set_time_limit(0);// this will keep the script from stopping if it takes longer then 30 seconds, must have this here
mysql_connect("localhost", "root", "pass");
mysql_select_db("database");
$query = mysql_query("SELECT email FROM account");
$emailsubject = "This is a sample subject!";
$emailbody = file_get_contents("email.html");
$fromaddress = "name@domain.tld";
// here we loop through the mysql array until we reach then end
while ($row = mysql_fetch_array($query, MYSQL_NUM))
{// start while
// we use the sql var. $row and we use the field 0 to pickup the email address
mail($row[0], $emailsubject, $emailbody, "From: " . $fromaddress . "\nX-Mailer: PHP 4.x");
}// end while
?>