A really BIG recordset!

Results 1 to 2 of 2

Thread: A really BIG recordset!

  1. #1
    JB Guest

    Default A really BIG recordset!

    Hi,<BR><BR>I am trying to write a email sender that will send emails from a recordset of email addresses. I have the following code working fine, but what if my record set conatins 4 million addresses?<BR><BR>Is there a way to break up a recordset into smaller pieces?<BR><BR>Here is my code.<BR><BR>Set rs = Server.CreateObject("ADODB.recordset")<BR>sql = "SELECT Email_Address FROM Email"<BR>rs.Open sql, strConnString, adOpenForwardOnly, adLockReadOnly, adCmdText<BR><BR>Do While Not rs.EOF<BR> Set objEMail = Server.CreateObject("CDONTS.NewMail") <BR> objEMail.From = strRetEmailAddress<BR> objEMail.To = rs("Email_Address")<BR> objEMail.Subject = strSubject<BR> objEMail.Body = strBody<BR> objEMail.Send<BR> Set objEMail = Nothing<BR> rs.MoveNext<BR>Loop<BR><BR>Any Help would be appreciated.<BR><BR>Thanks,<BR><BR>JB<BR><BR>

  2. #2
    Sreedharan Surendran Guest

    Default RE: A really BIG recordset!

    If you don&#039;t mind your receipient&#039;s address not showing in the "To" field, then you could use the "Bcc" field. Then you can send the email to multiple persons in one email. That is the standard method followed by people to ensure that all the addresses are not displayed. Of course, you can send all the emails using the "To" field, but then all the addresses will be available for anyone.<BR><BR>If you want each address to be in the "To" field individually, then I am afraid that you have to loop 4 million times. <BR><BR>An alternative would be to filter out the records, so that you get a small subset of email addresses. In that case, you will have to process it multiple times, so that all your filters together would add up to the final total.<BR><BR>I suppose that you are worried about the amount of time taken to send 4 million times? It will be long. Maybe you should investigate the possibility of doing it from the back-end, by using a service. Submit the job to a job queue, and let a service pick it up. In this way, you page will be released immediately, and you can continue with something else. But of course, then you have to have a service, and also an object which will do the job.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts