asp contact form
#1
asp contact form
Anyone have an asp contact form script that users serverside to send email?
Also need it to accept a variable, i.e. contactform.asp?ABC123
on the contact form under course it would have filled in and not editable to the user: ABC123
Thanks.
Also need it to accept a variable, i.e. contactform.asp?ABC123
on the contact form under course it would have filled in and not editable to the user: ABC123
Thanks.
#7
Scooby Regular
iTrader: (6)
Web Form: contact.htm
Obviously change the name and contact information if you like
<form method="POST" action="contact.asp">
Fields marked (*) are required
<p>Name:* <br>
<input type="text" name="Name">
<p>Address:<br>
<input type="text" name="Address">
<p>Telephone:<br>
<input type="text" name="Telephone">
<p><input type="submit" name="submit" value="Submit">
</form>
<p>
ASP Script: contact.asp
' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim Name
Dim Address
Dim Telephone
' get posted data into variables
EmailFrom = "test@scoobynet.com"
EmailTo = "owner@yoursite.com"
Subject = "Web site feedback"
Name = Trim(Request.Form("Name"))
Address = Trim(Request.Form("Address"))
Telephone = Trim(Request.Form("Telephone"))
' validation
Dim validationOK
validationOK=true
If (Trim(Name)="") 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 & "Address: " & Address & VbCrLf
Body = Body & "Telephone: " & Telephone & 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)
%>
Obviously change the name and contact information if you like
<form method="POST" action="contact.asp">
Fields marked (*) are required
<p>Name:* <br>
<input type="text" name="Name">
<p>Address:<br>
<input type="text" name="Address">
<p>Telephone:<br>
<input type="text" name="Telephone">
<p><input type="submit" name="submit" value="Submit">
</form>
<p>
ASP Script: contact.asp
' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim Name
Dim Address
Dim Telephone
' get posted data into variables
EmailFrom = "test@scoobynet.com"
EmailTo = "owner@yoursite.com"
Subject = "Web site feedback"
Name = Trim(Request.Form("Name"))
Address = Trim(Request.Form("Address"))
Telephone = Trim(Request.Form("Telephone"))
' validation
Dim validationOK
validationOK=true
If (Trim(Name)="") 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 & "Address: " & Address & VbCrLf
Body = Body & "Telephone: " & Telephone & 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)
%>
Thread
Thread Starter
Forum
Replies
Last Post