View Full Version : Form Question

02-10-2003, 05:57 PM
This might be very basic but i do not know the answer:

Do you know how?
If a User fills out a form (like a feedback form for example), have that form go to a database, get stored, and have the admin of that database receive an e-mail saying the database has been updated.

Here's the situation. I work for a school system that basically wants on online application. I can create the database with the required fields and point them in the fields and even write to database, that's the easy part (I can handle this). What I need is some code that once the data is wrote to the database, it e-mails the recipient that a new application has been submitted. If you could get me started, I could finish it out.

My part:
<FORM NAME="frmUser" ACTION="addnewapp.asp" METHOD="POST">

and have addnewapp.asp open the database and write to required fields.

Your part:
What next? I cannot use CGI or DLL's to help me do this. So Matt's formmail.pl is out of the question.

Thank you in advance, Phillip Ewing

02-10-2003, 06:22 PM
You can use the built in SMTP service (CDONTS) to format and send emails. It may or may not be enabled by default.


02-10-2003, 07:29 PM
I was asked to elaborate on my techniques:

I am planning on using ASP and CDONTS.

My idea:
After you successfully insert the data, call a sub
procedure that sends an email confirmation using

But if my website is being hosted by just a regular asp host. How do you get that dll to work? How do you register a dll if you do not accessibility to regedit?

I do not know that much about CDONTS and how they work. I am not opposed to that method but where do I begin. CDONTS registration is done by the hosting provider?? Do they do that kind of stuff?

Thank you in advance, Phillip

02-10-2003, 07:45 PM
You don't need to register anything. CDONTS is a built in part of ASP.

02-10-2003, 10:42 PM
Most webhost providers have CDONTS running by default since sending emails is so common. I would at least try sending an email to test out this assumption before you get too involved in the specifics.

If it doesn't work, they are probably aware of this and specifically have it turned off since it is just another possibly security problem. Most companies do have it turned on though.

02-11-2003, 01:14 AM
What they said... here's a basic CDONTS email:

Dim objMail, MessageBody

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 = "" & vbCrLf 'This is the body of the message, duh!
MessageBody = MessageBody & "" & vbCrLf

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

To include variables (such as those requested from a form), simply include them in the MessageBody, Subject, or whatever like:

MessageBody = MessageBody & "Subject: " & Request.Form("Subject") & vbCrLf & vbCrLf

vbCrLf is a "Carriage Return/Line Feed".

Much more information is available at: