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
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.