470,815 Members | 1,281 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

How Do I send the current form as e-mail

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
Jul 22 '05 #1
3 2058
you will need to.... sorry.
I mean you will have to render all the HTML into a string, parsing in your
values from the form, in order to send it.
What you are asking is the equivalent of saying I want to send what I see
through the camera lens, without taking the picture.

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Kassam" <Ka****@discussions.microsoft.com> wrote in message
news:D6**********************************@microsof t.com...
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

Jul 22 '05 #2
On Thu, 2 Jun 2005 12:53:18 -0700, Kassam
<Ka****@discussions.microsoft.com> 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
Jul 22 '05 #3
"Jeff Cochran" wrote in message
news:42****************@msnews.microsoft.com...
: On Thu, 2 Jun 2005 12:53:18 -0700, Kassam
: <Ka****@discussions.microsoft.com> 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
Jul 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by eswanson | last post: by
4 posts views Thread by Thomas Eichner | last post: by
1 post views Thread by mrajanikrishna | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.