Click to See Complete Forum and Search --> : CDONTS Problem... Please help


sweetstar
04-16-2003, 12:55 AM
Hi all,
I have the following two html and asp files and I am testing them in my local machine (IIS is installed) with windows XP I always get the error message (see the end of thread)... Can anybody track the problem with me. I badly need a solution for this problem.

Thanks in advance...

Sweetstar



1. html file (MailInput.htm):
-------------------------------------------------------------------
<html>
<head><title>Mail Input Page</title></head>
<body>
<form method="post" action="sendmail.asp" name="Inputform">
<table border="1" width="50%">
<tr><td width="48%">From</td>
<td width="52%">&nbsp;<input type="text" name="From" size="20"></td></tr>
<tr><td width="48%">To</td><td width="52%"><input type="text" name="to" size="20"></td></tr>
<tr><td width="48%">Subject</td><td width="52%"><input type="text" name="subject" size="20"></td></tr>
<tr><td width="48%">Body</td><td width="52%"><input type="text" name="body" size="20"></td></tr>
<tr><td width="48%"><input type="submit" value="Send" name="B1"><input type="reset"value="Reset" name="B2"></td>
<td width="52%">&nbsp;</td></tr>
</table>
</form>
</body>
</html>
-------------------------------------------------------------------

2. asp file (sendmail.asp):
-------------------------------------------------------------------
<%

'Declare local variables to hold the data from the Input form page that is used above.

Dim strTo
Dim strSubject
Dim strBody 'Strings for recipient, subject, boby
Dim objCDOMail 'The CDO object

'First we'll read in the values entered from the form into the Local variables
strFrom = Request.Form("From") 'Make sure the From field has no spaces.
strTo = Request.Form("to")
strSubject = Request.Form("subject")
strBody = Request.Form("body")

' Create an instance of the NewMail object.
Set objCDOMail = CreateObject("CDONTS.NewMail")

' Set the properties of the object
objCDOMail.From = StrFrom
objCDOMail.To = strTo
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody

' There are lots of other properties you can use.
' You can send HTML e-mail, attachments, etc...
' You can also modify most aspects of the message
' like importance, custom headers, ...
' Check the help files for a full list as well
' and the correct syntax.

' Some of the more useful ones I've included samples of here:
'objCDOMail.Cc = "mailto:mahdiya@aramco.com.sa" Notice this sending to more than one person!
'objCDOMail.Bcc = "sschofield@aspfree.com;steve@aspfree.com"
'objCDOMail.Importance = 1 '(0=Low, 1=Normal, 2=High)im a
'objCDOMail.AttachFile "c:\path\filename.txt", "filename.txt"

' Send the message!
objCDOMail.Send

' Set the object to nothing because it immediately becomes
' invalid after calling the Send method + it clears it out of the Server's Memory.
Set objCDOMail = Nothing
%>
<html>
<head><title>Sent Mail</title></head>
<body>
Your mail was sent to:<% = request("to") %><br>
The time that is was sent was: <% = Now %>

</body>
</html>
--------------------------------------------------------------------

3. The error detalis

Technical Information (for support personnel)

Error Type:
Microsoft VBScript runtime (0x800A01AD)
ActiveX component can't create object: 'CDONTS.NewMail'
/webapplications/sendmail.asp, line 17


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461; .NET CLR 1.0.3705)

Page:
POST 36 bytes to /webapplications/sendmail.asp

POST Data:
From=&to=&subject=test&body=&B1=Send:rolleyes: :rolleyes: :rolleyes:

Nicodemas
04-16-2003, 01:41 AM
Use this on line 17 instead of what you have. It seems I may have given you a bad reference if you copy and pasted...

Instead of this:
Set objCDOMail = CreateObject("CDONTS.NewMail")

Use this:
Set objCDOMail = Server .CreateObject("CDONTS.NewMail")

sweetstar
04-16-2003, 04:23 AM
Thanks Rob,

But still have problems.

See the following message:

Technical Information (for support personnel)

Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid class string
/webapplications/sendmail.asp, line 17


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461; .NET CLR 1.0.3705)

Page:
POST 48 bytes to /webapplications/sendmail.asp

POST Data:
From=test&to=test&subject=test&body=test&B1=Send

Nicodemas
04-16-2003, 04:54 AM
try looking up that error message on technet.com or google.com.

You're bound to find some answers.