Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Sample events > Email

Send mass email to all users

Scroll Prev Next More

 

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

Add page: After record added

Edit page: Before record updated

Edit page: After record updated

 

 

 

set rmail=CreateDictionary()
set data = dal.Table("users").QueryAll()
while not data.eof
  ' send the email
  rmail("to")=data("email")
  rmail("subject")="Sample subject"
  rmail("body")="Sample body"
  set result = runner_mail(rmail)
  ' if error happened print a message on the web page
  if not result("mailed") then
     response.write result("message") & "<br>"
     response.flush
  end if
  data.MoveNext
wend
data.close: data=nothing

See also:

Data Access Layer

About Database API

Send simple email

runner_mail function

DAL method: QueryAll()