R
Ray at
Mike said:The best way i learn this basic stuff is by knowing the answer (ie seeing a
working script) so I can see
where its wrong and work backwards.
Fair enough. :]
Here:
<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg, sBody
'''sBody wasn't dimmed before. It must be dimmed
'''when using Option Explicit. (Using Option Explicit
'''is a GOOD habit. I suggest you continue using it.)
'''x was not dimmed either.
Dim x
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
'''You now have a variable that contains the form data separated by line
breaks.
'''Concatenate IP address:
sBody = sBody & Request.ServerVariables("REMOTE_ADDR")
'''Now your body is ready, create your e-mail object
Set iMsg = CreateObject("CDO.Message")
iMsg.To = (e-mail address removed)
iMsg.Subject = "This is the Subject"
iMsg.From = "Me (e-mail address removed)"
'''For the body text, you want to use the variable from above
iMsg.TextBody = sBody
iMsg.Send
'Response.Redirect "/thank_you.htm"
'Response.REdirect is commented out. It's best not to redirect
'until you know everything's working well.
'
'For the sake of seeing what's going on, let's response.write the value
'of that sBody variable.
Response.Write sBody
'Note that vbCrLf is just a line break. Everything will appear
'on one line in the browser, but that's because a Web page would
'need <br> for line breaks. You don't care if it's displayed all
'in one line in the browser. A view-source will show it to you
'the same way that you will (hopefully) see it in an e-mail.
%>
Ray at work