Click to See Complete Forum and Search --> : Email Order Form


neoseeker191
02-11-2009, 09:52 PM
I have an Order Form which I run through an ASP script. This takes the information from the form and then displays it. Is there anyway to email what the ASP Script displays. Ive googled tutorials but none of them seem to tell me what I want to do.

The Order Form Page is at this link: Link (http://rcamodels.com/rcatest/ordernow2.html)

ASP Script:


<%
'*********
'Variables
'*********
Dim NameOnCard
Dim PaymentMethods
Dim CCNumber
Dim CCExpiration

Dim BILLING_Name
Dim BILLING_Company
Dim BILLING_Address
Dim BILLING_Address2
Dim BILLING_City
Dim BILLING_County
Dim BILLING_State
Dim BILLING_Province
Dim BILLING_Country
Dim BILLING_Zip
Dim BILLING_Phone
Dim BILLING_Extension
Dim BILLING_Fax
Dim BILLING_Email

Dim CheckSame

Dim SHIPPING_Name
Dim SHIPPING_Company
Dim SHIPPING_Address
Dim SHIPPING_Address2
Dim SHIPPING_City
Dim SHIPPING_County
Dim SHIPPING_State
Dim SHIPPING_Province
Dim SHIPPING_Country
Dim SHIPPING_Zip
Dim SHIPPING_Phone
Dim SHIPPING_Extension
Dim SHIPPING_Fax
Dim SHIPPING_Email

'If Statement Placeholders
Check = "on"
CheckValue = "No"

'********************
'Get Values From Form
'********************

'Card Info Form
PaymentMethods = Request.Form("PaymentMethods")
NameOnCard = Request.Form("PAYMENT_Name_On_Card")
CCNumber = Request.Form("CCNumber")
CCExpiration = Request.Form("CCExpiration")

'Billing Info Form
BILLING_Name = Request.Form("BILLING_Name")
BILLING_Company = Request.Form("BILLING_Company")
BILLING_Address = Request.Form("BILLING_Address")
BILLING_Address2 = Request.Form("BILLING_Address2")
BILLING_City = Request.Form("BILLING_City")
BILLING_County = Request.Form("BILLING_County")
BILLING_State = Request.Form("BILLING_State")
BILLING_Province = Request.Form("BILLING_Province")
BILLING_Country = Request.Form("BILLING_Country")
BILLING_Zip = Request.Form("BILLING_Zip")
BILLING_Phone = Request.Form("BILLING_Phone")
BILLING_Extension = Request.Form("BILLING_Extension")
BILLING_Fax = Request.Form("BILLING_Fax")
BILLING_Email = Request.Form("BILLING_Email")

'Checkbox
CheckSame = Request.Form("CheckSame")

'Check to see if box is checked
if StrComp(CheckSame,Check,1)=0 then
CheckSame = "Yes"
else
CheckSame = "No"
End if

'Shipping Info Form
SHIPPING_Name = Request.Form("SHIPPING_Name")
SHIPPING_Company = Request.Form("SHIPPING_Company")
SHIPPING_Address = Request.Form("SHIPPING_Address")
SHIPPING_Address2 = Request.Form("SHIPPING_Address2")
SHIPPING_City = Request.Form("SHIPPING_City")
SHIPPING_County = Request.Form("SHIPPING_County")
SHIPPING_State = Request.Form("SHIPPING_State")
SHIPPING_Province = Request.Form("SHIPPING_Province")
SHIPPING_Country = Request.Form("SHIPPING_Country")
SHIPPING_Zip = Request.Form("SHIPPING_Zip")
SHIPPING_Phone = Request.Form("SHIPPING_Phone")
SHIPPING_Extension = Request.Form("SHIPPING_Extension")
SHIPPING_Fax = Request.Form("SHIPPING_Fax")
SHIPPING_Email = Request.Form("SHIPPING_Email")

'**************
'Output to User
'**************

'Line Break For Reading Purposes
Response.Write("---------------------------- <br />")

'Card Info Output
Response.Write("<b>Card Type:</b> " & PaymentMethods & "<br />")
Response.Write("<b>Name On Card:</b> " & NameOnCard & "<br />")
Response.Write("<b>Credit Card #:</b> " & CCNumber & "<br />")
Response.Write("<b>Expiration (MM/YY):</b> " & CCExpiration & "<br />")

'Line Break For Reading Purposes
Response.Write("---------------------------- <br />")

'Billing Info Output
Response.Write("<b>Name:</b> " & BILLING_Name & "<br />")
Response.Write("<b>Company:</b> " & BILLING_Company & "<br />")
Response.Write("<b>Address:</b> " & BILLING_Address & "<br />")
Response.Write("<b>Address (Cont):</b> " & BILLING_Address2 & "<br />")
Response.Write("<b>City:</b> " & BILLING_City & "<br />")
Response.Write("<b>County:</b> " & BILLING_County & "<br />")
Response.Write("<b>State:</b> " & BILLING_State & "<br />")
Response.Write("<b>Province:</b> " & BILLING_Province & "<br />")
Response.Write("<b>Country:</b> " & BILLING_Country & "<br />")
Response.Write("<b>Zipcode:</b> " & BILLING_Zip & "<br />")
Response.Write("<b>Phone:</b> " & BILLING_Phone & "<br />")
Response.Write("<b>Extension:</b> " & BILLING_Extension & "<br />")
Response.Write("<b>Fax:</b> " & BILLING_Fax & "<br />")
Response.Write("<b>Email:</b> " & BILLING_Email & "<br />")


'Line Break For Reading Purposes
Response.Write("---------------------------- <br />")

'If box is not checked
if StrComp(CheckSame,CheckValue,1)=0 then

'Shipping Info Output
Response.Write("<b>Name:</b> " & SHIPPING_Name & "<br />")
Response.Write("<b>Company:</b> " & SHIPPING_Company & "<br />")
Response.Write("<b>Address:</b> " & SHIPPING_Address & "<br />")
Response.Write("<b>Address (Cont):</b> " & SHIPPING_Address2 & "<br />")
Response.Write("<b>City:</b> " & SHIPPING_City & "<br />")
Response.Write("<b>County:</b> " & SHIPPING_County & "<br />")
Response.Write("<b>State:</b> " & SHIPPING_State & "<br />")
Response.Write("<b>Province:</b> " & SHIPPING_Province & "<br />")
Response.Write("<b>Country:</b> " & SHIPPING_Country & "<br />")
Response.Write("<b>Zipcode:</b> " & SHIPPING_Zip & "<br />")
Response.Write("<b>Phone:</b> " & SHIPPING_Phone & "<br />")
Response.Write("<b>Extension:</b> " & SHIPPING_Extension & "<br />")
Response.Write("<b>Fax:</b> " & SHIPPING_Fax & "<br />")
Response.Write("<b>Email:</b> " & SHIPPING_Email & "<br />")

else
Response.Write("<b>Shipping Same as Billing?</b> " & CheckSame & "<br />")
End if



%>

ryanbutler
02-12-2009, 09:10 AM
Yeah, just use Collective Data Objects. I'd create a variable called message and then concatenate all the form field values into it, then send the message.

My google query turned up exactly what you need.

http://www.google.com/search?hl=en&q=send+emails+with+asp+&btnG=Search

neoseeker191
02-12-2009, 12:24 PM
I used this tutorial Link (http://www.sitepoint.com/article/sending-email-asp/2/)

How do I include all of my output in the body?

Do I just surround all the output with something like


Dim body

body = ("

Response.Write(" ")
Response.Write(" ")

")


and then have my code in my email.asp file


Mail.Body = Request.Form("Body")

ryanbutler
02-12-2009, 05:33 PM
Just create a message variable, and then concatenate on your fields

set mail=Server.CreateObject(“CDONTS.NewMail”)
mail.Subject="My Order Form"
mail.From="myfromaddres@domain.com"
mail.To="me@domain.com"
Dim message
message="Payment Methods" & Request.Form("PaymentMethods")
message=message & "Name on Card" & Request.Form("PAYMENT_Name_On_Card")
mail.Body=message
mail.Send

neoseeker191
02-12-2009, 06:15 PM
I get this error:

Microsoft VBScript compilation error '800a0408'

Invalid character

/rcatest/test.asp, line 9

set mail=Server.CreateObject(“CDONTS.NewMail”)
-----------------------------^

neoseeker191
02-12-2009, 07:57 PM
Nevermind if fixed it. Is there any way to make it send the email body with html tags?

ryanbutler
02-13-2009, 09:12 AM
I think you just embed HTML code inside the message variable. At this early morning, w/out additional coffee, I can't quite remember how ASP does it. In .NET, you have to specify the content type of the object's property, but ASP, I'm pretty sure you just embed the HTML code within. Google it, it'll turn up.

ryanbutler
02-13-2009, 09:31 AM
I was wrong:

http://www.w3schools.com/asp/asp_send_email.asp

Look at the section "Sending an HTML e-mail:"