Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDONTS creating duplicate email

Status
Not open for further replies.

CrimsonDiva

Programmer
Sep 22, 2000
30
0
0
US
Hi,

I'm trying to send out an indefinite number of emails using ASP/vbscript and CDONTS. I am able to receive all of the intended emails, but I notice that the actual message seems to be queueing, so that I receive all of the email text combined, in the last message sent. For example, if I send 2 messages out, the first one is fine. The second one has the text from the first message AS WELL AS the text that was intended for the 2nd message, itself. Why is this happening?


For intCount =1 to chkcount
objconn.BeginTrans
..

'Send email to each registrant
Set objNewMail = server.CreateObject("CDONTS.NewMail")
objNewMail.From = "support@somedomain.org"
objNewMail.To = email
'support HTML text for body
objNewMail.BodyFormat = CdoBodyFormatHtml
objNewMail.MailFormat = CdoMailFormatMime
objNewMail.Subject = "Some Subject"
emailbody = "Some Text"
objNewMail.Body = emailbody
objNewMail.Importance = 1
objNewMail.Send
set objNewMail = nothing
If Err.number <> 0 or objconn.Errors.Count > 0 then
'NEED TO CALL AN ERROR PAGE TO DISPLAY ERROR MESSAGES.
Response.Write &quot;Error: &quot;& Err.Description & &quot;(&quot; & SQL & &quot;)&quot;
Response.END
objconn.RollbackTrans
Else
objconn.CommitTrans
End If
Next
...


Thanks, in advance, for your help! [morning]
 
are you resetting the value of the bodytext? back to nothing for each interation of the loop
 
Hi spazman,

No, I am not restting the value of the bodytext. Should I do that? If so, how? objNewMail.Body =&quot;&quot; [ponder]
 
Well, someone else was able to help me out with this problem. All I needed to do was to set the body =&quot;&quot; after I send each email.

objNewMail.From = &quot;support@somedomain.org&quot;
objNewMail.To = email
'support HTML text for body
objNewMail.BodyFormat = CdoBodyFormatHtml
objNewMail.MailFormat = CdoMailFormatMime
objNewMail.Subject = &quot;Some Subject&quot;
emailbody = &quot;Some Text&quot;
objNewMail.Body = emailbody
objNewMail.Importance = 1
objNewMail.Send
emailbody =&quot;&quot;
set objNewMail = nothing

[bigsmile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top