faqts : Computers : Programming : Languages : Asp : ASP/VBScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

110 of 209 people (53%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

I am using "cdonts.newmail" in my program, getting error: ActiveX component can't create object: 'CD

Sep 2nd, 2002 10:56
Robin Paardekam, Johnny Deeds, http://www.aspfaq.com/show.asp?id=2026


To be honest: I looked for the answer to your question on 
www.aspfaq.com. This CDONTS-error was new to me. Now I do know why: I 
use Windows 2000 Server, and this is a Windows XP error. Here's the 
workaround for your problem. Good luck!
Robin Paardekam
http://www.paardekam.nl
____
This is because Microsoft is using a new progID of the DLL used to send 
mail through CDO (CDONTS.NewMail is being shuffled out). To deal with 
this, you can start using the new code style:
<% 
    sch = "http://schemas.microsoft.com/cdo/configuration/" 
    Set cdoConfig = Server.CreateObject("CDO.Configuration") 
    cdoConfig.Fields.Item(sch & "sendusing") = 2 
    cdoConfig.Fields.Item(sch & "smtpserver") 
= "<enter_mail.server_here>" 
    cdoConfig.fields.update 
    Set cdoMessage = Server.CreateObject("CDO.Message") 
    Set cdoMessage.Configuration = cdoConfig 
    cdoMessage.From = "[email protected]" 
    cdoMessage.To = "[email protected]" 
    cdoMessage.Subject = "Sample CDONTS NewMail" 
    cdoMessage.TextBody = "This is a test for CDONTS message" 
    cdoMessage.Send 
    Set cdoMessage = Nothing 
    Set cdoConfig = Nothing 
%>
Or you can use the workaround of copying cdonts.dll from a Windows 2000 
machine and regsvr32'ing it on the XP machine. I have not tested this 
method, so try it at your own risk. If it works, it may -- at least in 
the short term -- be the better solution. But you should plan to 
migrate your code eventually, because hosts running .NET Servers are 
not likely to be willing to register obsolete DLLs.
If you are using Windows 2000, you should start using CDO.Message and 
migrating your code. There is a decent article here: 
    http://msdn.microsoft.com/library/en-
us/cdosys/html/_cdosys_messaging.asp



© 1999-2004 Synop Pty Ltd