473,320 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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
1 2323
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: paii, Ron | last post by:
How do I setup a email with attachment for preview but require the user to push the SEND button in Outlook. I have the following function but it sends the email without the sender ever seeing it. ...
7
by: Pat | last post by:
I would like to send the Print Preview of a MS Access form to a Snapshot file. The form contains an OLE graph. BACKGROUND A snapshot of a report is possible. If I could I would use a report to...
1
by: sea | last post by:
I have Access 2002 and I am writing this application with a custom menu bar that has a print preview button -- the start up options hide the design window. The problem is that when an open form is...
2
by: Filips Benoit | last post by:
Dear All, SendObject has no where-argument! How can i email a report having user-defined filter, without opening the report? On a unbound form the user can set the criteria for a report....
5
by: VB Programmer | last post by:
I created a rtf html newsletter editor using ASP.NET. It has a preview button which previews the resulting newletter. The "preview" page basically has tables with labels in it. I fill in the...
0
by: Shawn Mehaffie | last post by:
I am creatign a screen saver and am having a problem with showing the screensaver form in the preview pane. The code works correctly in the the form does display within the preview window. I created...
2
by: Dean Slindee | last post by:
Anybody written code in VB.NET to: 1) show a print preview window of reports already written and stored in an Access 2002 database; or 2) execute the print of a report stored in an Access 2002...
2
by: Siv | last post by:
Hi, I am developing an application that produces various printed reports. I use my own custom print preview form and it works pretty well. What I'd like to do to improve it is to allow the user...
9
by: igotyourdotnet | last post by:
I need to create a print preview page BUT my page I need to print has a grid and in the grid I have 2 or 3 columns that have links I want to hide the columns with the links on my print preview page...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.