Q:

CDONTS in Loop Issue 2008 server

I have the following CDONTS code that works fine:
Dim CDONTSMail 
Set CDONTSMail = CreateObject("CDONTS.NewMail") 
CDONTSMail.From= "me@gmail.com" 
CDONTSMail.To= "me@gmail.com" 
CDONTSMail.Subject= "500.100 Error: " & objASPError.File 
strBody = "This is a test message." & vbCrLf 
CDONTSMail.Body= sErrorMes 
CDONTSMail.Send 
set CDONTSMail=nothing 

However the following when used in a loop errors out? any ideas?
'Create Mailer object and send message

CDONTSMail.From= "me@gmail.com" 
CDONTSMail.To = Session("Email") 
CDONTSMail.Subject = Subject 
strBody = MainMessage & vbCrLf
CDONTSMail.Body= strBody 
CDONTSMail.Send 

A:

You need to set CDONTSMail again.
Try this in your loop:
Set CDONTSMail = CreateObject("CDONTS.NewMail") 
CDONTSMail.From= "me@gmail.com" 
CDONTSMail.To= "me@gmail.com" 
CDONTSMail.Subject = Subject 
strBody = MainMessage & vbCrLf
CDONTSMail.Body= strBody 
CDONTSMail.Send 
set CDONTSMail=nothing 

