Click here to Skip to main content
14,301,484 members
Rate this:
Please Sign up or sign in to vote.
See more:
I'm just a beginner and I'm using the "form.html" and "form_ac.asp" code on my Fasthosts server which works fine but I'd like to have it return to a "Thanks.html" page after the submit button is pressed instead of the "email has been sent" message. What do I have to add to achieve this.
Carol Harmond

The code I'm using is as follows:-

<%@ Language="VBscript" %>
<% Option Explicit %>

<title>Message Sent</title>

'declare the variables that will receive the values
'receive the values sent from the form and assign them to variables
'note that request.form("name") will receive the value entered into the textfield
'called name, and so with email and message
Dim name, email, rin, message, NewMailObj

'create the mail object and send the details
Set NewMailObj=Server.CreateObject("CDONTS.NewMail")
NewMailObj.From = ""
NewMailObj.To = ""
NewMailObj.Subject = "New message sent.."
NewMailObj.Body = "the name entered was " & name & _
"<br>the email was " & email & _
"<br>the rin was " & rin & _
"<br>the message was:- <br> " & message

'you need to add the following lines FOR the mail to be sent in HTML format
NewMailObj.BodyFormat = 0
NewMailObj.MailFormat = 0
'Close the email object and free up resources
Set NewMailObj = nothing
Response.write "The email was sent, please use your back button to continue."

Updated 12-Sep-10 12:23pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

You need to do a Response.Redirect instead of Response.Write.

Have a look at it here: ASP Redirect Method[^]
Kunal Chowdhury «IN» 13-Sep-10 5:25am
Posted by:Carol Harmond
Thanks, works wonderfully, easy when you know how. I think this is going to be a steep learning curve. ;) :rose: :thumbsup:
Sandeep Mewara 13-Sep-10 5:46am
Yep... learning is the key. Good to know it helped. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100