Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003
    Posts
    5

    Question Unanswered: CDONTS to CDOSYS

    My server recently uprgraded to CDOSYS from CDONTS....i need to change this ASP so that it works for CDOSYS......can someone plz help...thanks!


    <%@ LANGUAGE="VBSCRIPT" %>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <%
    Dim objMail

    '//Rename this to the name of your button
    If (Request.Form("Submit") <> "") Then

    Set objMail = Server.CreateObject("CDONTS.NewMail")

    'Collecting form information
    email = Request.Form("Email")
    name = Request.Form("Name")
    phone = Request.Form("Phone")
    address = Request.Form("Address")
    city = Request.Form("city")
    state = Request.Form("state")
    zipcode = Request.Form("zip")
    comments = Request.Form("Comments")

    'Build message body
    BodyString = BodyString & "The following response was given via the Pastors' Response Page" & VbCrLf
    BodyString = BodyString & "Email: = " & Email & VbCrLf
    BodyString = BodyString & "Name: = " & Name & VbCrLf
    BodyString = BodyString & "Phone: = " & Phone & VbCrLf
    BodyString = BodyString & "Address: = " & Address & VbCrLf
    BodyString = BodyString & "City: = " & city & VbCrLf
    BodyString = BodyString & "State: = " & state & VbCrLf
    BodyString = BodyString & "Zip Code: = " & zip & VbCrLf
    BodyString = BodyString & "Comments" & Comments & VbCrLf


    objMail.From = email
    objMail.Subject = "Pastors' Reply"
    objMail.To = "jimmyt@filmthebible.org"
    objMail.Body = BodyString
    objMail.Send
    If Err.Number = 0 Then 'No errors so display the confirmation message
    Response.Write "Your Reply was succesfully sent. You will now be taken back to Pastors Golf Tour Home"
    Else
    Response.Write Err.Number & "<P>"
    Response.Write Err.Description & "<P>"
    Err.Clear
    Set objMail = nothing
    End If
    End IF
    %>
    </body>
    </html>

  2. #2
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Here are some notes I made about moving from CDONTS to CDO that hopefully might help you too.

    CDO is generally used instead of CDONTS on IIS 5 and after (actually the SMTP service within IIS) which is generally on servers after Win NT4 (although I think CDONTS is generally still supported too).

    Here are changes I made to convert CDONTS stuff to be CDO stuff instead:

    o Change objCDONTS to be called objCDO (actually this is just a cosmetic change)

    o This:
    Set objCDONTS = Server.CreateObject("CDONTS.NewMail")

    Changed to this instead:
    Set objCDO = Server.CreateObject("CDO.Message")

    o This:
    objCDONTS.Body = strEmailBody

    Changed to this instead:
    objCDO.TextBody = strEmailBody

    o This removed:
    ' Importance.
    ' (0=Low, 1=Normal, 2=High)
    objCDONTS.Importance = 1
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

  3. #3
    Join Date
    Sep 2003
    Posts
    5
    Thanks for the help......

    but.....

    most of the code lines that you asked me to change were not in my code

  4. #4
    Join Date
    Sep 2003
    Posts
    5

    HEHE i lied

    Here is my final code with your corrections......i cant test it yet b/c my server has to change the permissions but......



    <%@ LANGUAGE="VBSCRIPT" %>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <%
    Dim objCDO
    '//Rename this to the name of your button

    If (Request.Form("Submit") <> "") Then

    Set objCDO = Server.CreateObject("CDO.Message")

    'Collecting form information
    email = Request.Form("Email")
    name = Request.Form("Name")
    phone = Request.Form("Phone")
    address = Request.Form("Address")
    city = Request.Form("city")
    state = Request.Form("state")
    zipcode = Request.Form("zip")
    comments = Request.Form("Comments")

    'Build message body
    strEmailBody = strEmailBody & "The following response was given via the Pastors' Response Page" & VbCrLf
    strEmailBody = strEmailBody & "Email: = " & Email & VbCrLf
    strEmailBody = strEmailBody & "Name: = " & Name & VbCrLf
    strEmailBody = strEmailBody & "Phone: = " & Phone & VbCrLf
    strEmailBody = strEmailBody & "Address: = " & Address & VbCrLf
    strEmailBody = strEmailBody & "City: = " & city & VbCrLf
    strEmailBody = strEmailBody & "State: = " & state & VbCrLf
    strEmailBody = strEmailBody & "Zip Code: = " & zip & VbCrLf
    strEmailBody = strEmailBody & "Comments" & Comments & VbCrLf


    objCDO.From = email
    objCDO.Subject = "Pastors' Reply"
    objCDO.To = "jimmyt@filmthebible.org"
    objCDO.TextBody = strEmailBody
    objCDO.Send
    If Err.Number = 0 Then 'No errors so display the confirmation message
    Response.Write "Your Reply was succesfully sent. You will now be taken back to Pastors Golf Tour Home"
    Else
    Response.Write Err.Number & "<P>"
    Response.Write Err.Description & "<P>"
    Err.Clear
    Set objCDO = nothing
    End If
    End IF
    %>
    </body>
    </html>

  5. #5
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Looks like it might just work (hopefully)!
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

Posting Permissions

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