Send form data using CDO

K

Kenny

I'm trying to retrieve the data off a form (survey.htm) and email the results
back to me using CDO and ASP (survey.asp). I'm confused as to how to
retrieve the form data from survey.htm and send it using survey.asp. Below is
a sample ASP script that I found on ASPFAQ.com and it works fine, but now how
do I grab the info from a form and incorporate it into the emal. Thanks.
Appreciate any help or guidance.

Kenny

<%
sch = "http://schemas.microsoft.com/cdo/configuration/"

Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ' cdoSendUsingPort
.Item(sch & "smtpserver") = "servername"
.update
End With

Set cdoMessage = CreateObject("CDO.Message")

With cdoMessage
Set .Configuration = cdoConfig
.From = "(e-mail address removed)"
.To = "(e-mail address removed)"
.Subject = "Sample CDO Message"
.TextBody = "This is a test for CDO.message"
.Send
End With

Set cdoMessage = Nothing
Set cdoConfig = Nothing
%>
 
D

Drew

Depending on how you want to do it, if you want it to look nice, just make
your .TextBody something like this

..TextBody = "Name: " & Request.Form("Name") & "<br>Address: " &
Request.Form("Address")" 'and so on and so on

If you want it just thrown in there all messy looking just do this,

..TextBody = "Form Data is <br>" & Request.Form()

If your form method is set to GET, change Request.Form to
Request.Querystring.

HTH,
Drew
 
K

Kenny

Thanks, I really appreciate your help. I was able to use "& request.form() &"
to get the information but just like you said, it looked all mumble jumbled
together. I tried inserting html coding; however, using it in TextBody = " "
only repeats the html coding in the message, so when I type <br>, that's what
appears in the email generated the code <br> instead of the line break. How
do I import the form and use html?

Kenny
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

asp send mail cdo error 1
CDO Message help 1
CDOSYS send email with ASP 9
CDO yahoogroups mail problem 0
CDO Error 3
CDO authentication problem 2
CDO Email Help 2
sending email using CDO Message 1

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top