Firstly, ditch CDONTS and use CDO ...
http://aspfaq.com/show.asp?id=2119
Secondly, to save time and effort, you do not need two pages to send an
e-mail - a single page will suffice.
<%
'// begin p_cdomail.asp
Option Explicit
'// Determines whether to post
sRef = Request.Querystring("action")
'// Determine the visitors IP
sVIP = Request.ServerVariables("REMOTE_ADDR")
Select Case LCase(sRef)
Case "confirm" '// Send the e-mail
'// Get the vars from the post
sName = Request.Form("txtName")
sMail = Request.Form("txtMail")
sComments = Request.Form("txtComments")
'// Code goes here to process and send the e-mail
'// See the following for sending e-mail with CDO
'//
http://aspfaq.com/show.asp?id=2026
Case Else '// Show the form/preview
'// If the form has not been posted, set the forms
'// action query to preview
sAction = "?action=preview"
'// If the form has not been posted, set the forms
'// submit button value to Preview
btnSubmit = "Preview"
If LCase(sVIP) = "preview" Then '// Show preview
'// Get the vars from the post
sName = Request.Form("txtName")
sMail = Request.Form("txtMail")
sComments = Request.Form("txtComments")
'// Here we can spit them out for previewing
Response.Write "<center>Preview before
sending</center><br><br>"
Response.Write "<b>Name:</b" & sName & "<br>"
Response.Write "<b>Mail:</b" & sMail & "<br>"
Response.Write "<b>Comments:</b" & sComments & "<br>"
'// Change the submit buttons value on the form
btnSubmit = "Confirm"
'// Change the forms action query to confirm
sAction = "?action=confirm"
End If
'// Your form goes here
%>
<form method="post" action="p_cdomail.asp<%=sAction%>"
name="frmSendMail">
<input type="text" name="txtName" value="<%=sName%>">
<input type="text" name="txtMail" value="<%=sMail%>">
<input type="text" name="txtComments" value="<%=sComments%>">
<input type="submit" name="btnSubmit" value="<%=btnSubmit%>">
</form>
<%
End Select
%>
--
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
<bo***********@gmail.comwrote in message
news:11**********************@a14g2000cwb.googlegr oups.com...
Hello All
In my ASP page, I use CDONT to send email to client. But, I need to
allow user preview and edit the email content before sending it out.
Any advices?
I have two ASP pages - h_email.asp and h_email_action.asp
Inside the h_email.asp, I create a form and allow user to input
information for the email.
In the h_email_action.asp, it contains asp code for extracting fields'
value in h_email.asp and store them into database as well as send
email. All fields' value will be created as a string for the email
content.
Could anyone give me some suggestions?
Best Regards,
Bon