Solved

CDONTS on Windows 2003 Server

Posted on 2003-11-07
11
50,543 Views
Last Modified: 2011-04-14
I've been working with CDONTS email messaging for quite a while on a Windows 2000 server that also had SQL 2000 installed on it.  This server was our Intranet server so it had IIS on it too.  I had a SQL stored procedure that sent the mail, and all worked perfectly.

Recently, we purchased 2 new servers to replace the old one.  We decided to load Windows 2003 and put the SQL databases on one server (HMCNTDOCSQL) and the web services (IIS on a different server -- HMCNTDOC1). The SMTP service is running on HMCNTDOC1,a nd I set it up with the correct name of our SMTP server.  As you can probably guess, it isn't working any more.  I'm using the same SQL stored procedure, and no emails.

Yesterday, I edited this code into my web page (.asp):

Dim MyBody
Dim MyCDONTSMail

Set MyCDONTSMail=CreateObject("CDONTS.NewMail")
MyCDONTSMail.From="somebody@nnnnn.com"
MyCDONTSMail.To="Betsy.Valanti@Halifax.org"
MyCDONTSMail.Subject="Test"
MyBody="I Hope This Works"
MyCDONTSMail.Body=MyBody
MYCDONTSMail.Send
set MyCDONTSMail=nothing

When I use this, I get the following error message:  

Microsoft VBScript runtime error '800a01ad'

ActiveX component can't create object: 'CDONTS.NewMail'

/ITChangeNotification/IT/Insert.asp, line 57


I think the code is correct, so I'm wondering if there is something I missed in setting up IIS.

Any suggestions?

0
Comment
Question by:BetsyV
  • 3
  • 2
  • 2
  • +4
11 Comments
 
LVL 9

Accepted Solution

by:
fz2hqs earned 500 total points
ID: 9701543
CDONTS was depreciated and you need to use CDO instead, it isn't a massive change here is a template

      Set objErrMail= Server.CreateObject("CDO.Message")
      With objErrMail
            .From = "From Address<from@domain.com>"
            .To = "recipient@domain.com"
            .Subject = "Subject Line"
            .HTMLBody = CStr("" & strBody)
            .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
            .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "IP of smtp server"
            .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
            .Configuration.Fields.Update
            .Send
      End With
0
 

Author Comment

by:BetsyV
ID: 9701705
I think I'm closer, but still getting an error.  When I added the above code to my page, I get the following:

CDO.Message.1 error '8004020a'

The SMTP server name is required, and was not found in the configuration source.

I have the IP address of the smtp server, but do I also need a line for the server name?

Thanks !!
0
 
LVL 9

Expert Comment

by:fz2hqs
ID: 9702007
0
 

Author Comment

by:BetsyV
ID: 9702092
Thanks so much.  I found my error.  I had the IP of our smtp server, and should have put the name.  Once I fixed this, it worked great.

I really appreciate the help.
0
 

Expert Comment

by:kmiller7
ID: 9856205
I need help converting a mail script from CDONTS to CDO script.  I know just enough to make other peoples code work but I am having trouble converting this code I already have to work properly.
Thank you for any Help!!


<%

Dim strSender
Dim strRecipientsName
Dim strRecipients
Dim strSubject
Dim strMessage

strRecipientsName = Request.Form("Name")
strRecipients = Request.Form("Email")
strSubject = "From: " & Request.Form("YName") & " Picture"
strMessage = "Hello " & Request.Form("Name") & vbCrLf & vbCrLf
strMessage = strMessage & Request.Form("Msg") & vbCrLf & vbCrLf
strMessage = strMessage & "You received this from : " & Request.Form("YName") & " " & Request.Form("YEmail")
strSender = Request.Form("YEmail")
%>
<%

            Set objNewMail = Server.CreateObject ("CDONTS.NewMail")
                objNewMail.cc = "email@address.com"
            objNewMail.BodyFormat = 1
            objNewMail.MailFormat = 0
            on error resume next '## Ignore Errors
            objNewMail.Send strSender, strRecipients, strSubject, strMessage
            If Err <> 0 Then
                  Err_Msg = Err_Msg & "<li>Your request was not sent due to the following error: " & Err.Description & "</li>"
            End if
            on error resume next '## Ignore Errors
Set objNewMail = Nothing
%>
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 9

Expert Comment

by:fz2hqs
ID: 9856795
kmiller7 - Don't jump in other peoples threads, start one of your own
0
 
LVL 1

Expert Comment

by:vbishop
ID: 10324271
Excellent bit of code fz2hqs!

The Internet Community Appreciates it!

The code worked perfectly the first time I tried it!

Best,

Vincil Bishop
http://peoplesinformation.com
0
 

Expert Comment

by:varun_minhas
ID: 10760940
Hi, I'm new here but my question is on topic. I'm currently upgrading to server 2003 with exchange 2003 (fresh installation) and nothing as far as forms seems to want to work. As far as I remember with server 2000, all you had to do was change the appilcation pool under the website properties to "Low IIS processed" but with the new system I cannot seem to get forms to work. The error message I receive is as follows:
 
Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed
/membership.asp, line 42
800401f3

On top of which my current server 2000 with exchange server 2000 seem to keep freezing. Virtually everyday or ever other day I have to come in and restart the machine. It just falls asleep and never gets back up. I've check all the power management settings, etc. They are highly unreliable and I need to get some stable machines working.
Please help.  
0
 
LVL 1

Expert Comment

by:vbishop
ID: 10761340
varun_minhas -

More than happy to help.

Please start a new thread, then email me the link:

{{email address removed for member's protection --alimu/Page Editor IIS}}

Many times I have found that MS Servers behave better if they get their daily reboot.

The error appears as if you are trying to use an activex dll that is not registered.

Best,

Vincil Bishop
{{website address removed as per: http:/help.jsp#hi106 --alimu/Page Editor IIS}}
0
 

Expert Comment

by:mrnmnew
ID: 13256096
or you could add CDONTS to windows 2003 :

To copy CDONTS to a computer running Windows Server 2003

On the source server, copy Cdonts.dll from the systemroot\system32 folder to a floppy disk.

On the target server, copy Cdonts.dll from the floppy disk to the folder systemroot\system32.

To register CDONTS, on the target server, in the Run dialog box, type cmd, and then click OK.

At the command prompt, change to the systemroot\system32 directory, and then type:

regsvr32 windir\system32\cdonts.dll

If the process is successful, the following message displays:

DllRegisterServer in cdonts.dll succeeded.

Click OK.
0
 

Expert Comment

by:smilbandit
ID: 14919423
I could not get it to run using a cdonts.dll from a windows nt install.  I'm not sure where I got it but I had another cdonts.dll on my windows 2000 install that was bigger in file size (~400k) and that worked fine.  The version of the file I used is 6.0.3940.15 and said that it was from microsoft exchange.
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Debug Tools to analyse IIS process: This article focus on taking memory dumps from IIS to determine which code is taking more time and to analyse which calls hangs/causes more CPU usage. To take dumps,download the following. Install1: To st…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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