467,118 Members | 1,012 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,118 developers. It's quick & easy.

How to do email preview on ASP?

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

Jul 3 '06 #1
  • viewed: 2111
Share:
1 Reply
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

Jul 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by paii, Ron | last post: by
2 posts views Thread by Filips Benoit | last post: by
5 posts views Thread by VB Programmer | last post: by
9 posts views Thread by igotyourdotnet | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.