PDA

View Full Version : ASP Error



smartbuyweb
07-13-2005, 07:42 PM
I have IIS 6 and I am trying to make a form page for asp. The code it
<%

' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim Name
Dim Email
Dim Pages
Dim Pictures
Dim EmailAccounts
Dim eCommerce

' get posted data into variables
EmailFrom = Trim(Request.Form("EmailFrom"))
EmailTo = "Skikool12@hotmail.com"
Subject = Trim(Request.Form("Subject"))
Name = Trim(Request.Form("Name"))
Email = Trim(Request.Form("Email"))
Pages = Trim(Request.Form("Pages"))
Pictures = Trim(Request.Form("Pictures"))
EmailAccounts = Trim(Request.Form("EmailAccounts"))
eCommerce = Trim(Request.Form("eCommerce"))


' prepare email body text
Dim Body
Body = Body & "Name: " & Name & VbCrLf
Body = Body & "Email: " & Email & VbCrLf
Body = Body & "Pages: " & Pages & VbCrLf
Body = Body & "Pictures: " & Pictures & VbCrLf
Body = Body & "EmailAccounts: " & EmailAccounts & VbCrLf
Body = Body & "eCommerce: " & eCommerce & VbCrLf

' send email
Dim mail
Set mail = Server.CreateObject("CDO.Message")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send

' redirect to success page
Response.Redirect("Thankyou.htm" & EmailFrom)
%>

and I get the error

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Body'

/contact.asp, line 53

Anyone know what I should do?

Twey
07-14-2005, 07:11 PM
mail.Body = Body
... should be:

mail.TextBody = Body

Also (I don't know ASP, so I could be wrong here), I have a feeling that

Response.Redirect("Thankyou.htm" & EmailFrom)
will give a 404 when the user is redirected to something like "Thankyou.htmuser@domain.com".
I think it more likely that you mean to say

Response.Redirect("Thankyou.htm&" & EmailFrom)
to pass EmailFrom as a GET variable.

smartbuyweb
07-19-2005, 01:50 PM
I looked over it again after I posted this. I changed the text.body thing and it works great so thanks anyway.