View Full Version : Emailing a form

07-26-2002, 10:51 PM
How do you email the data submited by a form. I checked asp101.com but their tutorial script would error out on my machine.

07-27-2002, 12:32 AM
Check out:


If your host can send using CDONTS, I often use this blank template to create my emails:

Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.To = ""
objMail.From = ""
objMail.cc = ""
objMail.bcc = ""
'objMail.mailFormat = 0 'This is for HTML
'objMail.bodyFormat = 0 'This is for HTML

MessageBody = "" & CHR(13)
MessageBody = MessageBody & "" & CHR(13)

objMail.Subject = ""
objMail.Body = MessageBody
Set objMail = Nothing

07-29-2002, 09:44 PM
My problem is that i'm running IIS on a different server than the exchange box. How do you connect the 2 together to send an email. I get an error message of Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid class string
How can I get this to work

07-31-2002, 01:07 AM
I'm not sure what you mean by "Exchange Box"... I've always sent emails directly from my applications to this point... anyone?

08-01-2002, 05:58 AM
First off, do you have an SMTP server running?
If not, install one. IIS 5.0 comes with one on the windows 2000 CD.

08-01-2002, 04:56 PM
I'm actually running the webserver on my windows xp box. I do have smtp running on the XP box. I get the error at this line
Set objMail = Server.CreateObject("CDONTS.NewMail")
Does windows XP come with CDONTS?

08-01-2002, 08:09 PM
If you have an SMTP then you should have no problems..

I want you to take this exact and save it as mail.asp in your wwwroot folder... then open it up like


<%@ Language=VBScript %>
<% Option Explicit %>
Dim mailObj
Set mailObj = CreateObject("CDONTS.NewMail")
With mailObj
.BodyFormat = 1 ' 1=Text, 0=HTML
.MailFormat = 1 ' 1=Text, 0=MIME
.Importance = 1 ' 0=Low, 1=Normal, 2=High
.Cc = ""
.Bcc = ""
.Subject = "Your e-mailing system works!"
.Body = "Your E-mailing system now works!" & vbcrlf & "Your Welcome" & vbcrlf & vbcrlf & "~Alex Robson"
End With
Set mailObj = Nothing

08-05-2002, 08:48 PM
I tried what you said.
I get this error now.
Error Type:
Microsoft VBScript runtime (0x800A01AD)
ActiveX component can't create object: 'CDONTS.NewMail'
/mail.asp, line 5

I check to see if snmp was running. It was. I stopped it, started it and ran the script again. Still same error message.
Any other ideas?
Thank you

08-06-2002, 10:05 AM
I want you to fill me in on some information.

What version of windows are you running?
What version of IIS are you running?
Do you use any HTML or ASP writing programs to help you with ASP or HTML code? (Example: Dreamweaver)

What I think the error is telling you, is that you don't have cdonts. But after you give me this information, I can help you fix that problem!

08-06-2002, 10:42 AM
I remember, I read a artical about it.
CDNTNS means "Collaboration data objects for NT server", in NT server, it is CDO 1.X, and after update to windows 2000, it will be updated to cdo 2.0. when you update your server, CDO 1.x will not be replaced, and you can use both cdo 1.x and cdo 2.0 object.

But when you install windows2000 directly , CDO1.x will not be installed, (only cdo 2.0). in cdo 2.0 you cannot use "newmail", you must use "message". I think you can find it in microsoft website.


Sorry, I did Not try it. But just a idea. I hope it is helpful for you.

Good luck

08-06-2002, 05:31 PM
I am using windows xp for my os, and I'm running version 5.1 of IIS. Does CDONTS come installed on XP? Am I better off running IIS on a NT2000 machine?
If I don't have CDONTS installed where do I get the download from?
I am using UltraEdit as my text editor. Its kinda like notepad.

08-07-2002, 12:41 AM
5.1 eh?
Ok, do this: Reinstall SMTP and re update your hotfix. (hotfix is a security thing, it should auto update on xp (I beleive))
If that doesn't work, I can get you a mail component that will work just fine.

08-07-2002, 06:30 PM
I uninstalled smtp but now when I install it again it wants a whistler profession cd. What is that. I don't have that disk. It needs that file inorder to install smtp. Now what?

08-08-2002, 12:08 AM
What do you mean it needs another cd?
So you have a virus scanner? Scan your system for anything.

What XP version do you have? HOME, PRO, SERVER?

This is strange. If this is a dedicated computer for the web servers, you might want to go with windows 2000 pro, or windows 2000 server.
If you don't mind, just try reinstalling the OS you have now and see how the smtp was installed before, without the other cd.

Btw, is your copy of windows xp a ware? If it is, maybe you are missing that cd because of that reason, or something is wrong when you installed the OS.

I don't see how you can have the smtp server at all, without the cd in the first place.

08-09-2002, 02:26 PM
I have XP Professional. I do have a lagit copy of XP. The only thing I can think of is that I have installed a bunch of updates off of microsofts.update website and some how it updated the smtp server that now when I try to reinstall it, its asking for something it updated off of a whistler professional cd.
I will mess around with it and see if I can get it installed again.
I do plan in the future to move the web server onto a windows 2000 server out the .net server.
I'm sure I will have many questions on CDONTS
Thanks for your help =)

08-09-2002, 02:56 PM
I got smtp installed again. If anyone else runs into this problem go here http://www.dynamiclink.host.sk/dll-files/library.e/Dll-Files-E.html to get your dll's.
I still get the same error thow.
Error Type:
Microsoft VBScript runtime (0x800A01AD)
ActiveX component can't create object: 'DCONTS.NewMail'
/Asbuilt4/email.asp, line 2
I may just move this to a 2000 server to see if it will work.

08-10-2002, 09:04 AM
You can always get a differnt mailing component. CDONTS isn't the only one.
I have no opinon on what the nest on is, or could be.
But here:

I heard that was a good one!
"w3 JMail Free, v 4.3"

08-13-2002, 10:40 PM
Hey guys,
I finally got this working.
This is what I had to do just in case someone else runs into this problem.
I had to download the cdonts.dll file and register it. Then I had to setup a relay on the exchange box so the emails would get sent.
Thank you for all of your help!! :thumbsup:

08-14-2002, 11:46 AM
No problem, Hatch.
Glad I could help you in some way.