[thelist] ASP and form question

Brian Johnson brian at bnia.com
Mon Jul 8 17:50:00 CDT 2002


Sharon,

I think that perhaps objMail.Body is expecting to see a string on the
right-hand side - not another object.

I would try one of two things:

One: (Not sure if this will work for reason stated above.)
objMail.Body = ""
objMail.Body = objMail.Body & "address: " & Response.Form("address") &
vbCrLf
objMail.Body = objMail.Body & "city: " & Response.Form("city") & vbCrLf
...

This intializes objMail.Body to an empty string first. If it chokes
again on Line 10 with the same error, you'll have to try option two.

Two: (I would do this personally. I believe this was suggested earlier
as well.)
Dim strBody
strBody = "address: " & Response.Form("address") & vbCrLf
strBody = "city: " & Response.Form("city") & vbCrLf
...
objMail.Body = strBody

This concatenates as string then assigns it to the .Body object.

Also, if you intend to write back some of the form information in a
response screen or if you are using HTML mail, you might need to encode
it for characters like < and >.  You'll use something like:

Response.Write(Server.HTMLEncode(strInput))

where strInput = strBody for example.

This will convert the string: <p>address: 123 commerce street</p>
to &lt;p&gt;address: 123 commerce street&lt;/p&gt;

Hope this helps.
-Brian


Sharon F. Malone wrote:

>However .... now this is what I'm getting:
>
>Microsoft VBScript runtime error '800a01b6'
>
>Object doesn't support this property or method: 'Body'
>
>/chocfoundry/html/process.asp, line 9
>
>Line 9 is the first occurrence of objMail.Body = objMail.Body & blah blah.
>objMail.Body = objMail.Body & "address: " & Request.Form("address")     & vbCrlf & vbCrlf
>
>What is this???? What do you suggest?
>
>






More information about the thelist mailing list