ERRMSG: Using CDONTS on Windows 2003,2008

Symptom

The following error is returned when running CDONTS.NewMail on Windows 2003 (IIS 6)Invalid class string
' or
ActiveX component can't create object: 'CDONTS.NewMail'
' or
The "SendUsing" configuration value is invalid.

Cause

The problem is due to Microsoft's change in the name and progID when the DLL is used
to send mail through CDO. 

Resolution

Use the following Code: 
<%
    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 = "from@me.com"
    cdoMessage.To = "to@me.com"
    cdoMessage.Subject = "Sample CDONTS NewMail"
    cdoMessage.TextBody = "This is a test for CDONTS message"
    cdoMessage.Send
    Set cdoMessage = Nothing
    Set cdoConfig = Nothing
%>

  • 0 Kunder som kunne bruge dette svar
Hjalp dette svar dig?

Relaterede artikler

What are the steps to buy SSL certificate?

This is what you need to do:1. Please ensure your whois info (registrar) info is...

I am getting error when trying to send mail from php

I'm getting the following error when trying to send an email from a PHP program: Warning: mail():...

I made some changes to my site, but when I view it still has the old pages, why is that?

It is likely that you are pulling up cache (store) version of your page. To fix this hold down...

Can I use a Datasource or DSN to connect to my database?

Datasources/DSN's are used to transfer information to and from a database, such as Access or SQL...

How to test Oracle and PHP connectivity?

Use this code as an example: replace scott with your user name replace tige with your...