Search Tools Links Login

Generic Email Form Handler using CDONTS

Email any form from your site using CDONTS (IIS's built-in smtp). Just 10 lines of code handles any size form! Email will display message in the form of fieldname: fieldvalue in proper tab order, with line breaks between each name/value pair.

Original Author: BebeZed


Required form fields: Email, Subject. Email is the sender's email that will appear in the "From" field on the email. Both fields may hidden inputs if desired. Any number of other inputs may be added as desired.


Basic knowledge of html to set up the form is required. This code does not do anything after sending email, so you may want to redirect to another page or display a message that the mail was sent. Be sure to change "" to your actual email address!


for i=1 to request.form.count
  strMessage = strMessage & request.form.key(i) & ": " & request.form.item(i) & vbCrLf
Set objMail = CreateObject("CDONTS.Newmail")
objMail.From = request.form("Email")
objMail.To = ""
objMail.Subject = request.form("Subject")
objMail.Body = strMessage
Set objMail = Nothing

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 117 times




No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.