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
var rs = GlobalVars.dal.Table("UsersTableName").QueryAll();
XVar data;
var rmail = XVar.Array();
while (data = CommonFunctions.db_fetch_array(rs))
{
rmail["to"] = data["EmailAddress"];
rmail["body"] = "Check what's hot this season";
rmail["subject"] = "Monthly newsletter";
var ret = MVCFunctions.runner_mail(rmail);
if(!ret["mailed"])
MVCFunctions.Echo(ret["message"]);
}
See also: