...

View Full Version : Cdonts Error!!! Help!!!!



jaywhy13
01-13-2005, 05:32 PM
The following code gets me this error: please help!!!!

<%@LANGUAGE="VBSCRIPT"%>
<%Option Explicit%>
<%
Dim myStr, allRecipients, objMail, user

myStr=request.queryString("sendStr")
'myStr is of the form name@doman.com;anothername@domain.com;

allRecipients=Split(myStr,";")

Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = "admin@genesis.com"
objMail.Subject = request.queryString("subject")
objMail.Body = request.queryString("msg")

for each user in allRecipients
objMail.To = user
objMail.Send
next
set objMail = nothing
%>
<html>
<head>

<title>User Notification</title>
</head>
<body onLoad="window.close()">



</body>
</html>



================================================
error '80040108'
/sendTexts.asp, line 16


which is:
objMail.To = user

Bullschmidt
01-17-2005, 02:19 PM
<<
objMail.To = user
>>

I don't see where the variable called user is ever set to be anything.

jaywhy13
01-18-2005, 05:32 AM
I have it up at the top.... Dim user

And then i use it to say
For each "user" in allRecipients

Bullschmidt
01-18-2005, 05:46 AM
Yes you're right.

Still you might want to do this (somewhere before the error line but after where the variable user is actually set) just to check that the variable user really contains what you think it should:

Response.Write "user: " & user & "<br><br>"
Response.Flush

Bullschmidt
01-18-2005, 05:48 AM
But now that I check it isn't THIS the error line?:

for each user in allRecipients

So perhaps just before that check that allRecipients is really what you think it is:

Response.Write "allRecipients: " & allRecipients & "<br><br>"
Response.Flush

(And maybe think about using a different variable name than user as that sounds like it could possibly be a reserved name?)

jaywhy13
01-18-2005, 03:46 PM
Hey, here is what I tried.... I tried to put ALL the code in the for loop and then set it back to the object back to Nothing at the end of each loop.

(Did I mention that the code worked despite the error since the beginning tho?)

It looks summin like this now:


<%@LANGUAGE="VBSCRIPT"%>
<%Option Explicit%>
<%
Dim myStr, allRecipients, objMail, user

myStr=request.queryString("sendStr")
'myStr is of the form name@doman.com;anothername@domain.com;

allRecipients=Split(myStr,";")


for each user in allRecipients
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = "admin@genesis.com"
objMail.Subject = request.queryString("subject")
objMail.Body = request.queryString("msg")

objMail.To = user
objMail.Send

set objMail = nothing

next
%>

But still, I am unsatisfied with that code... because I really have no idea what it takes out of the server to create the component each new time and secondly it just doesn't feel wright seeing that the only that changes in each loop is the "to" address. The message is always the same, so is the from address and everything else

I used the code I printed and I got zero errors! So that should mean that there was nothing wrong with allRecipients or with user



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum