#!/usr/bin/php -q 2007) and (select count(*) from notary n3 where n3.from=u.id) > 1 group by email, fname, lname having sum(points)>99; "; // echo $query; // comment next line when starting to send mail not only to me $res = mysql_query($query); $xrows = mysql_num_rows($res); while($row = mysql_fetch_assoc($res)) { echo $row['pts']."..".$row['email']."...\n"; // uncomment next line to send mails ... sendmail($row['email'], "[CAcert.org] Assurer Test", $lines, "teus@cacert.org", "", "", "CAcert Events Organisation", "returns@cacert.org", 1); } // 1x cc to events.cacert.org sendmail("philipp@cacert.org", "[CAcert.org] Assurer Test", $lines, "teus@cacert.org", "", "", "CAcert Events Organisation", "returns@cacert.org", 1); // 1x mailing report to events.cacert.org sendmail("philipp@cacert.org", "[CAcert.org] Assurer Report", "assurer information sent to $xrows recipients.", "support@cacert.org", "", "", "CAcert Assurer Organisation", "returns@cacert.org", 1); ?>