Solved

IIS 6 dosent support CDONTS Help!

Posted on 2004-04-11
9
695 Views
Last Modified: 2007-12-19
Hello

I moved my WEB site to IIS6, 2003 server only to find that CDONTS is no longer supported.

I have several asp pages that where using Mysql statements to populate the SQL database then send the results via email using CDONTS.

Now that I have to USE the CDO object can anyone tell me what the syntax should be? HELP

This is a portion of the ASP page that was using mySQL and CDONTS.

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      mySQL= "INSERT INTO knowledge_base "
      mySQL= mySQL & "(date,contact_person,agency,contact_phone,contact_email,type_of_request,reason_for_change_enhancement,module,problem,display_cs,display,status,fix,support_username,client_display) "
      mySQL= mySQL & "VALUES ('" & Request.Form("date") & "','"
      mySQL= mySQL & Request.Form("contact_person") & "','"
      mySQL= mySQL & Request.Form("agency") & "','"
      mySQL= mySQL & Request.Form("contact_phone") & "','"
      mySQL= mySQL & Request.Form("contact_email") & "','"
      mySQL= mySQL & Request.Form("type_of_request") & "','"
      mySQL= mySQL & Request.Form("reason_for_change_enhancement") & "','"
      mySQL= mySQL & Request.Form("module") & "','"
      mySQL= mySQL & replace(Request.Form("problem"),"'","''") & "','"
     'mySQL= mySQL & Request.Form("problem") & "','"
      mySQL= mySQL & Request.Form("display_cs") & "','"
      mySQL= mySQL & Request.Form("display") & "','"
      mySQL= mySQL & Request.Form("status") & "','"
      mySQL= mySQL & Request.Form("fix") & "','"
      mySQL= mySQL & Request.Form("support_username") & "','"
      mySQL= mySQL & Request.Form("client_display") & "')"
          
      '========================================================
    ' Execute the connection with the SQL string.
    ' This runs the SQL string against the database and inputs
    ' the information.
    '=========================================================
myConnection.Execute mySQL
      
      '=== Close the connection.
      myConnection.Close
                  
      '=== Set the connection equal to Nothing.
    '=== This frees resources used by it.
      Set myConnection = Nothing

'====================================================================
    ' Set up variables:
    '      myCDONTSMail = A CDONTS mail object.
    '      strFrom = A string containing the source e-mail address.
    '      strTo = A string containing the destination e-mail address.
    '      strSubject = A string containing the subject of the e-mail.
    '      strBody = A string containing the body of the e-mail.
    '====================================================================
    Dim myCDONTSMail
    Dim strFrom
    Dim strTo,strCC
    Dim strSubject
    Dim strBody

      '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      ' Assign the source e-mail address. Change this to your e-mail
      ' address.
      '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    'strFrom="WebServer@somewhere.net"
    strFrom=Request.Form("contact_email")
    '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    ' Assign the destination e-mail address. In this example, get the
    ' e-mail address from the form field called "EMail".
    ' You can customize this by removing the EMail form field and
    ' changing the following line to this:
    '      strTo="example@microsoft.com" ß Change this to your e-mail
    ' address.
    '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    strTo="support@somewhere.net "
    strCC=Request.Form("contact_email")

    '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' The following line is the subject of the e-mail. You can change
' this to a subject that is customized to your liking.
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
strSubject = "Support Request"

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' The following lines create the body of the message. This can be
' anything you want it to be.
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
strBody="The following information was submitted:" & Chr(13)
strBody = strBody & Request.Form("date") & " " & Chr(13)
strBody = strBody & Request.Form("agency") & " " & Chr(13)
strBody = strBody & Request.Form("contact_email") & Chr(13)
strBody = strBody & Request.Form("type_of_request") & Chr(13)
strBody = strBody & Request.Form("reason_for_change_enhancement") & Chr(13)
strBody = strBody & Request.Form("module") & Chr(13)
strBody = strBody & Request.Form("problem") & Chr(13)
' strBody = strBody & Chr(13) & Request.Form("Address") & Chr(13)
' strBody = strBody & Request.Form("City") & Chr(13)
' strBody = strBody & Request.Form("Region") & Chr(13)
' strBody = strBody & Request.Form("PostalCode") & Chr(13)
strBody = strBody & Chr(13) & "thank you."

'====================================================================
' The SET statement creates the CDONTS mail object in preparation
' for sending the e-mail message.
'====================================================================
Set myCDONTSMail = CreateObject("CDONTS.NewMail")
  myCDONTSMail.Subject=strSubject
  myCDONTSMail.Body=strBody
  myCDONTSMail.From=strFrom
  myCDONTSMail.To=strTo
  myCDONTSMail.CC=strCC
  ' ** UNCOMMENT THE TWO LINES FOR HTML FORMATTING **
  'myCDONTSMail.BodyFormat=0
  'myCDONTSMail.MailFormat=0

'====================================================================
' The following line sends the mail message using the source e-mail,
' destination e-mail, subject, and body that were defined earlier.
'====================================================================
'myCDONTSMail.Send strFrom,strTo,strSubject,strBody
myCDONTSMail.Send

      '=== Set the CDONTS mail object to NOTHING to free resources.
Set myCDONTSMail = Nothing

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' For information about how to customize the rest of this page, see the
' Customizing the Confirmation Page section of this document. Sections
' that are discussed in the Customizations section are delimited
' by percent signs.
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0
Comment
Question by:dhieb
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 20

Assisted Solution

by:jitganguly
jitganguly earned 25 total points
ID: 10803064
0
 
LVL 7

Accepted Solution

by:
brgivens earned 400 total points
ID: 10803267
0
 

Author Comment

by:dhieb
ID: 10803463
Thanks for the posts

For the moment I like the idea of registering the cdonts.dll
Unfortunately after registering the DLL I now get an “800a0046|Permission_denied” is the IIS log.
Any ideas?
0
 
LVL 7

Expert Comment

by:brgivens
ID: 10803570
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 21

Assisted Solution

by:ap_sajith
ap_sajith earned 75 total points
ID: 10803637
Try out this code..

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     mySQL= "INSERT INTO knowledge_base "
      mySQL= mySQL & "(date,contact_person,agency,contact_phone,contact_email,type_of_request,reason_for_change_enhancement,module,problem,display_cs,display,status,fix,support_username,client_display) "
      mySQL= mySQL & "VALUES ('" & Request.Form("date") & "','"
      mySQL= mySQL & Request.Form("contact_person") & "','"
      mySQL= mySQL & Request.Form("agency") & "','"
      mySQL= mySQL & Request.Form("contact_phone") & "','"
      mySQL= mySQL & Request.Form("contact_email") & "','"
      mySQL= mySQL & Request.Form("type_of_request") & "','"
      mySQL= mySQL & Request.Form("reason_for_change_enhancement") & "','"
      mySQL= mySQL & Request.Form("module") & "','"
      mySQL= mySQL & replace(Request.Form("problem"),"'","''") & "','"
     'mySQL= mySQL & Request.Form("problem") & "','"
      mySQL= mySQL & Request.Form("display_cs") & "','"
      mySQL= mySQL & Request.Form("display") & "','"
      mySQL= mySQL & Request.Form("status") & "','"
      mySQL= mySQL & Request.Form("fix") & "','"
      mySQL= mySQL & Request.Form("support_username") & "','"
      mySQL= mySQL & Request.Form("client_display") & "')"
         
     '========================================================
    ' Execute the connection with the SQL string.
    ' This runs the SQL string against the database and inputs
    ' the information.
    '=========================================================
myConnection.Execute mySQL
     
     '=== Close the connection.
     myConnection.Close
               
     '=== Set the connection equal to Nothing.
    '=== This frees resources used by it.
     Set myConnection = Nothing

'====================================================================
    ' Set up variables:
    '     myCDONTSMail = A CDONTS mail object.
    '     strFrom = A string containing the source e-mail address.
    '     strTo = A string containing the destination e-mail address.
    '     strSubject = A string containing the subject of the e-mail.
    '     strBody = A string containing the body of the e-mail.
    '====================================================================
    Dim myCDONTSMail
    Dim strFrom
    Dim strTo,strCC
    Dim strSubject
    Dim strBody

     '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     ' Assign the source e-mail address. Change this to your e-mail
     ' address.
     '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    'strFrom="WebServer@somewhere.net"
    strFrom=Request.Form("contact_email")
    '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    ' Assign the destination e-mail address. In this example, get the
    ' e-mail address from the form field called "EMail".
    ' You can customize this by removing the EMail form field and
    ' changing the following line to this:
    '     strTo="example@microsoft.com" ß Change this to your e-mail
    ' address.
    '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    strTo="support@somewhere.net "
    strCC=Request.Form("contact_email")

    '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' The following line is the subject of the e-mail. You can change
' this to a subject that is customized to your liking.
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
strSubject = "Support Request"

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' The following lines create the body of the message. This can be
' anything you want it to be.
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
strBody="The following information was submitted:" & Chr(13)
strBody = strBody & Request.Form("date") & " " & Chr(13)
strBody = strBody & Request.Form("agency") & " " & Chr(13)
strBody = strBody & Request.Form("contact_email") & Chr(13)
strBody = strBody & Request.Form("type_of_request") & Chr(13)
strBody = strBody & Request.Form("reason_for_change_enhancement") & Chr(13)
strBody = strBody & Request.Form("module") & Chr(13)
strBody = strBody & Request.Form("problem") & Chr(13)
' strBody = strBody & Chr(13) & Request.Form("Address") & Chr(13)
' strBody = strBody & Request.Form("City") & Chr(13)
' strBody = strBody & Request.Form("Region") & Chr(13)
' strBody = strBody & Request.Form("PostalCode") & Chr(13)
strBody = strBody & Chr(13) & "thank you."

'====================================================================
' The following line sends the mail message using the source e-mail,
' destination e-mail, subject, and body that were defined earlier.
'====================================================================
'myCDONTSMail.Send strFrom,strTo,strSubject,strBody
'myCDONTSMail.Send
CALL SendMailCDOSYS(strFrom,strTo,strSubject,strBody,False,"localhost")
' Change the sMailServer parameter to "yourmailservername" if it is not localhost

'=== Set the CDONTS mail object to NOTHING to free resources.
'Set myCDONTSMail = Nothing

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' For information about how to customize the rest of this page, see the
' Customizing the Confirmation Page section of this document. Sections
' that are discussed in the Customizations section are delimited
' by percent signs.
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

' Function to send email Using CDOSYS
'** USAGE **
'** strMailBody="<Font Color=Red><B>Test HTML String</B></Font>"
'** CALL SendMailCDOSYS("a@b.com","c@d.com","test",strMailBody,True,"mail.yahoo.com")

Sub SendMailCDOSYS(strFrom,strTO,strSubject,strMailBody,blnHTML,sMailServer)
On Error Resume Next
     Dim objCDOConf,objCDOSYS
     ' ** CREATE THE E-MAIL SERVER OBJECT **
     Set objCDOSYS = Server.CreateObject("CDO.Message")
     Set objCDOConf = Server.CreateObject ("CDO.Configuration")

     ' ** SET AND UPDATE FIELDS PROPERTIES **
     With objCDOConf
          ' ** OUT GOING SMTP SERVER **
          .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sMailServer
          ' ** SMTP PORT **
          .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport")  = 25
          ' ** CDO PORT **
          .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
          ' ** TIMEOUT **
          .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
          .Fields.Update
     End With

     ' ** UPDATE THE CDOSYS CONFIGURATION **
     Set objCDOSYS.Configuration = objCDOConf

     With objCDOSYS    
          ' ** WHO THE E-MAIL IS FROM **
          .From = strFrom

          ' ** WHO THE E-MAIL IS SENT TO **
          .To = strTo
                   
          ' ** THE SUBJECT OF THE E-MAIL **
          .Subject = strSubject
           
          ' ** SET THE E-MAIL BODY FORMAT (HTMLBody=HTML TextBody=Plain) **
          If blnHTML = True Then
          .HTMLBody = strMailBody
          Else
          .TextBody = strMailBody
          End If
           
          ' ** SEND THE E-MAIL **
          .Send
     End with                    
       
     ' ** CLOSE THE SERVER MAIL OBJECT **
     Set objCDOSYS = Nothing
End Sub


Cheers!!
0
 

Author Comment

by:dhieb
ID: 10803676
ap_sajith

Thanks for the effort I will give it a go.
0
 
LVL 20

Expert Comment

by:jitganguly
ID: 10805046
>>For the moment I like the idea of registering the cdonts.dll

Thats not a good idea. Why would you use somethign that doesn't really support ? I am not against it, but is there a isue using CDO ?
instead of CDONTS ?
0
 

Author Comment

by:dhieb
ID: 10810638

Thanks,

No, the only issue at the moment is that  IIS6 and CDO was an unexpected delay. I couldnt hold off on some server moves.
But I do appreciate the input. Converting to CDO will occur just not today.

Thanks
0
 

Author Comment

by:dhieb
ID: 10810641
Thanks everone for the input....
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now