Asp : random afsendelse af mail
Kan jeg få denne funktion til at sende nyhedsbrev til random 50 brugere, istedet for at sende til alle brugere om det er ud nu ?skal man lave en random udvælgelse i sin sql eller i loopet længere nede ?
Her er lidt kode:
'our variables for the email and for our objects
Dim strTo , strFrom , strSubject , strBody , objCDONTS , objRS
'get the results from the create newsletter form
strSubject = Request.Form("subject")
strBody = Request.Form("message")
set objRS = Server.CreateObject("ADODB.Recordset")
objRS.ActiveConnection = MM_conn_STRING
objRS.Source = "SELECT Distinct p_email FROM users WHERE p_newsletter = 'y' AND p_approve = 'y' AND (p_ban is null)"
objRS.CursorType = 0
objRS.CursorLocation = 2
objRS.LockType = 3
objRS.Open()
objRS_numRows = 0
'just a message to the admin
Response.Write ("<br><font size='2'> Newsletters are being sent..</font>")
response.Write ("<br><br>")
'loop through entries
While not objRS.EOF
'create an instance of the CDONTS object
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")