[thelist] ASP and form question

Joel Canfield joel at spinhead.com
Sun Jul 7 19:38:01 CDT 2002


> Just tried it hard coding the objMail.From field and FINALLY
> got an email reply. However, all it has is:
>
> Sent by:
>
> At least I got a reply. But I wonder why I only got "Sent
> by:" without the other information I filled out? What do you think?

You're not getting the form info into the variables, so the 'From' field was
empty, and now the other form fields are still empty.

Try assigning the form fields to variables, then using the variables in the
mail function. Also, write the variables to the browser to see if you're
getting the expected values.

Like this:

<%
Dim objMail, strFrom, strSubject, strTo, strBody
strFrom = "info at 24caratdesign.com"
strSubject = "Message from The Chocolate Foundry"
strTo = "sfmalo at 24caratdesign.com"
strBody = "Sent by: " & Request.Form("name") & vbCrlf & vbCrlf
&Request.Form("message")

Response.Write("strFrom = " & strFrom & "<br />")
Response.Write("strSubject = " & strSubject & "<br />")
Response.Write("strTo = " & strTo & "<br />")
Response.Write("strBody = " & strBody & "<br />")

set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = strFrom
objMail.Subject =  strSubject
objMail.To =  strTo
objMail.Body = strBody
objMail.Send
set objMail = nothing
>
Response.Redirect("confirm.html")
%>

Let me know if the form values aren't making it to the mail page, and we'll
figure out why.

joel



More information about the thelist mailing list