Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Angry Cdonts Error!!! Help!!!!

    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

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    <<
    objMail.To = user
    >>

    I don't see where the variable called user is ever set to be anything.
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

  • #3
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I have it up at the top.... Dim user

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

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    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
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

  • #5
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    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?)
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

  • #6
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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:

    Code:
    <%@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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •