我有以下可以正常使用的CDONTS代码:
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
但是在循环中使用以下时出错?任何想法?
'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
答案 0 :(得分:1)
您需要再次设置CDONTSMail。
在你的循环中试试这个:
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