jcx1028
09-24-2008, 09:00 PM
I currently have a basic contact form on a website that sends the information to my email address and redirects the user to a Thank You page. What I'd like to add, if possible, is an automatic reply to the individual submitting the form, with the subject line reading something like, "Thank you" and the body reading something like, "A member of our team will be in touch shortly."
Can this be done via the .asp file? Any assistance would be greatly appreciated. Here's what I'm working with so far...
<%
' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim Name
Dim Phone
Dim Email
Dim Comments
' get posted data into variables
EmailFrom = Trim(Request.Form("Email"))
EmailTo = "info@rgnengineering.com"
Subject = "Contact Us"
Name = Trim(Request.Form("Name"))
Phone = Trim(Request.Form("Phone"))
Email = Trim(Request.Form("Email"))
Comments = Trim(Request.Form("Comments"))
' validation
Dim validationOK
validationOK=true
If (Trim(EmailFrom)="") 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 & "Phone: " & Phone & VbCrLf
Body = Body & "Email: " & Email & VbCrLf
Body = Body & "Comments: " & Comments & VbCrLf
' send email
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = Email
mail.Subject = Subject
mail.Body = Body
mail.Send
' redirect to success page
Response.Redirect("thank-you.html")
%>
Can this be done via the .asp file? Any assistance would be greatly appreciated. Here's what I'm working with so far...
<%
' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim Name
Dim Phone
Dim Email
Dim Comments
' get posted data into variables
EmailFrom = Trim(Request.Form("Email"))
EmailTo = "info@rgnengineering.com"
Subject = "Contact Us"
Name = Trim(Request.Form("Name"))
Phone = Trim(Request.Form("Phone"))
Email = Trim(Request.Form("Email"))
Comments = Trim(Request.Form("Comments"))
' validation
Dim validationOK
validationOK=true
If (Trim(EmailFrom)="") 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 & "Phone: " & Phone & VbCrLf
Body = Body & "Email: " & Email & VbCrLf
Body = Body & "Comments: " & Comments & VbCrLf
' send email
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = Email
mail.Subject = Subject
mail.Body = Body
mail.Send
' redirect to success page
Response.Redirect("thank-you.html")
%>