Hi:

I just join this forum and am new to asp so I'm hoping someone can help me with this issue.

The email form works great, it's just one issue I can't figure out.

What I'm trying to figure out is, when the user fills his/her email in the Email field of the form and the client receives the feedback form, how to I get the email from the form to fill in the "To:" field when the client hits "Reply"?

Right now, if you look at the form code, the "To:" and "From:" field will both have sp@sp.com in them.

If Ron were to put ron@sp.com in the Email field of the form, how can I get it to fill into the "To:" field when I hit "Reply"


Any help/feedback or quick code would be really appreciated. It's the last piece I seem to need for this.

Thanks, and here is the code I have (using CDOSYS):


<<A href="mailto:%@LANGUAGE="VBSCRIPT">%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Set objMail = Server.CreateObject("CDO.Message")
objMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"

objMail.From = "sp@sp.com" ' change this to an email address
objMail.To = "sp@sp.com" ' change this to your email address
objMail.Subject = "Contact Information" ' change this to your subject
'Set the e-mail body format (HTMLBody=HTML TextBody=Plain)
'Set the e-mail body format (HTMLBody=HTML TextBody=Plain)
objMail.HTMLBody = "<font size=2 face=verdana>"
objMail.HTMLBody = objMail.HTMLBody & "<b>First Name:</b> " & Request.Form("First Name")& "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<b>Last Name:</b> " & Request.Form("Last Name")& "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<b>Address:</b> " & Request.Form("Address") & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<b>City:</b> " & Request.Form("City") & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<b>State:</b> " & Request.Form("State") & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<b>Zip Code:</b> " & Request.Form("Zip Code") & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<b>Phone:</b> " & Request.Form("Phone") & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<b>Fax:</b> " & Request.Form("Fax") & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<b>Email:</b> " & Request.Form("Email") & "<br><br>"
objMail.HTMLBody = objMail.HTMLBody & "<b>Comments:</b> " & Request.Form("Comments") & "<br><br>"
objMail.HTMLBody = objMail.HTMLBody & "<b>Sent at</b> " & Now() & "</font>"
objMail.Send()
Set objMail = Nothing
%>


Just request the email address from the form as done further down your code:
objMail.To = Request.Form("Email")

You really should done evaluation before, though.

Hi:

Thanks for the input.

I think I solved it.

I added:

objMail.ReplyTo = Request.Form("Email")

and it's doing just what I want.


When you say "You really should done evaluation before, though.", what do you mean? Is there better way to go about this?

I pretty new to asp, so any input is appreciated.

Thanks again for the reply and help,

SP

When you say "You really should done evaluation before, though.", what do you mean? Is there better way to go about this?

You're welcome ;-)

I mean, it's good practice to evaluate if the user has entered a valid address.
In this case it is probably not too important, but in some cases you would want to check the address entered by the user. That is, if the address entered has the form of xxxx@xxxx.xxx
Some asp mail components fail if the address doesn't have this form, so sometimes it's necessary....

A general rule of thumb: you can neven do too much evaluation :cheesy:

Thanks.

I see what you mean. I sometimes validate it with javascript.

I know it's possible to do it with asp, and it can check if it's valid, etc.

But I'm not there yet..lol..

Something I will have to learn as I go.

But thanks again for the input,

SP

This article has been dead for over six months. Start a new discussion instead.