Forum Moderators: open
I'm guessing the form generator is a little old and does not run on newer versions of IIS? I really don't know squat about ASP/VB but maybe someone will be able to spot the error on line 36...
Set mail = Server.CreateObject("CDONTS.NewMail")
Here are the ASP script and form pages...
contact.asp
<%
' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim name
Dim comments' get posted data into variables
EmailFrom = Trim(Request.Form("EmailFrom"))
EmailTo = "test@yahoo.com"
Subject = Trim(Request.Form("Subject"))
name = Trim(Request.Form("name"))
comments = Trim(Request.Form("comments"))' validation
Dim validationOK
validationOK=true
If (Trim(EmailFrom)="") Then validationOK=false
If (Trim(name)="") Then validationOK=false
If (Trim(comments)="") Then validationOK=false
If (validationOK=false) Then Response.Redirect("error.htm?" & EmailFrom)' prepare email body text
Dim Body
Body = Body & "name: " & name & VbCrLf
Body = Body & "comments: " & comments & VbCrLf' send email
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send' redirect to success page
Response.Redirect("ok.htm?" & EmailFrom)
%>
For test purposes here is the clientside form...
form.html
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Contact Form</title>
<style type="text/css">
label {
border: #000 dotted 1px;
float: left;
width: 100px;
}
</style>
</head><body>
<form method="POST" action="contact.asp">
<fieldset>
<label for="name">Name:</label><input id="name" name="name" type="text" />
<br />
<label for="emailfrom">Email:</label><input id="emailfrom" name="emailfrom" type="text" />
<br />
<label for="subject">Subject:</label><input id="subject" name="subject" type="text" />
<br />
<label for="comments">Comments:</label><textarea id="comments" name="comments"></textarea>
<br />
<input name="submit" type="submit" value="Send" />
</fieldset>
</form></body>
</html>
This is what IIS 2k3 uses by default now. It no longer comes installed with CDONTS.
Then, change this line:
mail.Body = Body
to:
mail.TextBody = Body
if you are submitting just regular text
or
mail.HTMLBody = Body
if you are submitting HTML in your email
Chip-