To send an email with new data to email addresses from the user table, use the following code in one of the following events:
•Add page: Before record added
•Edit page: Before record updated
•Edit page: After record updated
global $dal;
//select emails from Users table
$tblUsers = $dal->Table("UsersTableName");
$rs = $tblUsers->QueryAll();
while ($data = db_fetch_array($rs))
{
$email=$data["EmailAddress"];
$from="admin@test.com";
$msg="Check what's hot this season";
$subject="Monthly newsletter";
$ret=runner_mail(array('to' => $email, 'subject' => $subject,
'body' => $msg, 'from'=>$from));
if(!$ret["mailed"])
echo $ret["message"]."<br>";
}
See also: