Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How Do I send the current form as e-mail

Reply
Thread Tools

How Do I send the current form as e-mail

 
 
Kassam
Guest
Posts: n/a
 
      06-02-2005
Hi MVPs out there.

I have constructed an order form and the users will enter the informtion. I
now need to send the filled out form as an e-mail (body being the HTML with
the fille din data) to a predefined e-mail address. I know how to use CDO. I
don't want to go to another page to recontruct the HTML as the '.body'
Thank you in anticipation.

Kassam
 
Reply With Quote
 
 
 
 
Jeff Cochran
Guest
Posts: n/a
 
      06-03-2005
On Thu, 2 Jun 2005 12:53:18 -0700, Kassam
<(E-Mail Removed)> wrote:

>Hi MVPs out there.
>
>I have constructed an order form and the users will enter the informtion. I
>now need to send the filled out form as an e-mail (body being the HTML with
>the fille din data) to a predefined e-mail address. I know how to use CDO. I
>don't want to go to another page to recontruct the HTML as the '.body'
>Thank you in anticipation.


So don't go to another page, post back to the same page. Construct
the body as you wish, and use variables for the form field values.
Post back to the same form, and fill the values back into the form
from the posted values at the same time as you fill in the body of the
email. Use an If/Then to determine if the page has been posted back,
using a hidden field, and if so, do the CDO bits.

Jeff
 
Reply With Quote
 
 
 
 
Roland Hall
Guest
Posts: n/a
 
      06-03-2005
"Jeff Cochran" wrote in message
news:(E-Mail Removed)...
: On Thu, 2 Jun 2005 12:53:18 -0700, Kassam
: <(E-Mail Removed)> wrote:
:
: >Hi MVPs out there.
: >
: >I have constructed an order form and the users will enter the informtion.
I
: >now need to send the filled out form as an e-mail (body being the HTML
with
: >the fille din data) to a predefined e-mail address. I know how to use
CDO. I
: >don't want to go to another page to recontruct the HTML as the '.body'
: >Thank you in anticipation.
:
: So don't go to another page, post back to the same page. Construct
: the body as you wish, and use variables for the form field values.
: Post back to the same form, and fill the values back into the form
: from the posted values at the same time as you fill in the body of the
: email. Use an If/Then to determine if the page has been posted back,
: using a hidden field, and if so, do the CDO bits.

To add to what Jeff wrote...

I wrap my HTML in server-side VBScript as one string. Then when I post back
to the same page, the string will be filled in with my input variables and
that is the HTML content I send out with CDOSYS.

I only send the output via mail if the form has been posted. An easy way to
check is to add a name value pair to your submit button.

sub prt(str)
Response.Write str & vbCrLf
end sub

prt "<html>"
prt "<body>"
prt "<form action="""" method=""post"" />"
prt "<input type=""text"" name=""iname"" value="""" /><br />"
' additional form input elements
prt "<input type="submit" name="submit value="Submit" />"
prt "</form>"
prt "</body>"
prt "</html>"

Then put everything in this conditional to see if you post to the screen or
send via mail.

dim s, strName, valid
strName = Server.HTMLEncode(Replace(Request.Form("iname"),"' ","''"))
s = Server.HTMLEncode(Replace(Request.Form("submit")," '","''"))
if s <> "" then
' validate input
if valid then
' mail it
prt "Thank you"
prt "<span style=""cursor: pointer; border: 1px solid black;
background-color: #efe"" onclick=""location.href='/'"">Continue</span>"
Response.End
else
' Post error
' Fall through to display form on screen
end if
end if

None of this is tested for errors/typos.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
how to send the current page's content as part of a form Andre Charbonneau Javascript 1 08-04-2006 10:57 PM
javascript form action = send form details to ASP page iam247@gmail.com Javascript 2 08-07-2005 08:16 AM
submit form, validate form, set cookie, send email, download file mhawkins19@adelphia.net Javascript 1 03-17-2005 08:19 AM
How to change the current thread current culture at run time. Manu ASP .Net 1 07-20-2003 03:27 PM



Advertisments