Click to See Complete Forum and Search --> : asp web email form help


febrocks
04-18-2006, 02:35 PM
Hello everyone,
I'm sure you want to hear this but I don't know ASP and this script is from hostned. I configured it for my site and it works but the script does not include the name of the person submitting. Can I do that with this script? And if so, how can I ? If you can post a link on the info would be great.

code: html
<form method="post" action="sendjmail.asp">
<h2>Web Email Form</h2>
<p>We would like to hear from you. Please complete this form and click the &quot;Submit&quot; button and we will address your question/comments as soon as we get them. Thank you.</p>
<table border="0" cellpadding="5" cellspacing="3" width="400" id="table1" style="border-collapse: collapse; border-style: dashed; border-width: 1px" align="center">
<tr>
<td bgcolor="#D9FBFF"><font face="Arial"><font size="2"><b>Your name
<br>
</b></font>
<input type="text" size="25" name="name"></font></td>
</tr>
<tr>
<td bgcolor="#D9FBFF"><font face="Arial"><font size="2"><b>Your email address</b>
(ie: youraddress@yourdomain.com)<br>
</font>
<input type="text" size="25" name="email"></font></td>
</tr>
<tr>
<td bgcolor="#D9FBFF"><!--<font face="Arial"><font size="2"><b>Recipient
email</b><br>
</font>--><input type="hidden" size="25" name="recipient" value="glogems@glogems.com"><!--</font>--></td>
</tr>
<tr>
<td bgcolor="#D9FBFF"><font face="Arial"><font size="2"><b>Subject </b><br>
</font><select name="subject" size="1">
<option value="information">Information</option>
<!--<option value="price">Price List Request</option>-->
<option value="feedback">Feedback</option>
</select><font size="2"> </font></font></td>
</tr>
<tr>
<td bgcolor="#D9FBFF"><font face="Arial"><font size="2"><b>Enter your
comments here </b><br>
</font><textarea name="body" cols="40" rows="5" wrap="PHYSICAL">
</textarea><font size="2"> </font></font></td>
</tr>
<tr>
<td bgcolor="#D9FBFF">
<p align="center"><font face="Arial">
<input type="submit" value=" Submit "></font></p>
</td>
</tr>
</table>
<p><font size="2" face="Arial">&nbsp;</font></p>
</form>

code: sendjmail.asp

<html>

<head>
<title></title>
<!-- Script courtesey of HostNed.com - Affordable Web Hosting for Personal and Small Business websites -->
</head>

<body>

<p align="center"><font face="Arial" size="5">Email Form</font></p>
<font face="Arial"><%
Name = Request.Form("name")
SenderEmail = Request.Form("email")
Subject = "Regarding " & Request.Form("subject")
Recipient = Request.Form("recipient")
Body = Request.Form("body")

Set JMail = Server.CreateObject("JMail.SMTPMail")

' Below you should enter your own SMTP-server
JMail.ServerAddress = "smtp.hostglobe.com"

JMail.Sender = Senderemail
JMail.Subject = Subject

JMail.AddRecipient Recipient

JMail.Body = Body

JMail.Priority = 3

JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.Logging = True
JMail.Execute

%> </font><center><font face="Arial" size="3">Your email has been sent to <%= Recipient %><br />
</font></center>
<p align="center"><font face="Arial"><a href="webform.html">Back to form</a></font></p>
<p align="center"><font face="Arial"><a href="index.html">Back to Home Page</a></font></p>
</body>

</html>

Thanks,
Eugene

lmf232s
04-19-2006, 10:35 AM
febrocks,
You already have the page set up to get the name of the user, your just not using it.

Name = Request.Form("name")

That line gets the Name that was entered into the name field but again that variable is going unused. You might want to try something like this (depending on where you want this name to show up)


Name = Request.Form("name")
SenderEmail = Request.Form("email")
Subject = "From: " & Name & "<BR>Regarding " & Request.Form("subject")
Recipient = Request.Form("recipient")
Body = Request.Form("body")

febrocks
04-19-2006, 11:13 AM
Yes. I did see the, name =, but I didn't know why it was not showing the name. Now that I saw what you added to display the name, I do understand. And ofcourse it worked. Thank you so much.

Eugene