Hi guys,
I'm completely new to ASP. I'm actually looking for some help hosting a particular asp page on my website. I'm creating a Feedback Form that will automatically send an e-mail to my inbox when someone posts feedback. Here is the code modified (i believe) for my need:
<%
'==========================================================
' Codefixer's Feedback Form
'http://www.codefixer.com/codesnippets/feedbackform.asp
'You may wish to add client side and server side validation
'==========================================================
%>
<html>
<head>
<title>Feedback Form</title>
</head>
<body bgcolor="#FFFFFF">
<%
If Request.Form="" Then %>
<form method="post" action="feedback.asp" name="form1">
<div align="center">Send us your Feedback.<br>
<br>
</div>
<div align="center">
<table width="75%" border="0">
<tr>
<td>Name</td>
<td>
<input type="text" name="txtName">
</td>
</tr>
<tr>
<td>E-mail</td>
<td>
<input type="text" name="txtEmail">
</td>
</tr>
<tr>
<td>Comment</td>
<td>
<textarea name="txtFeedback" cols="40" rows="7"></textarea>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</td>
</tr>
</table>
</div>
</form>
<br>
<%
Else
'receive the form values
Dim sName, sEmail, sFeedback
sName=Request.Form("txtName")
sEmail=Request.Form("txtEmail")
sFeedback=Request.Form("txtFeedback")
' create the HTML formatted email text
Dim sEmailText
sEmailText = sEmailText & "<html>"
sEmailText = sEmailText & "<head>"
sEmailText = sEmailText & "<title>HTML Email</title>"
sEmailText = sEmailText & "</head>"
sEmailText = sEmailText & "<body>"
sEmailText = sEmailText & "<font color='#00000' size='2' face='Verdana'>"
sEmailText = sEmailText & "Feedback message from: " & sName & "<br>"
sEmailText = sEmailText & "Message:" & sFeedback & "<br>"
sEmailText = sEmailText & "Date & Time:" & Now() & "<br>"
sEmailText = sEmailText & "IP :" & Request.ServerVariables("REMOTE_ADDR")
sEmailText = sEmailText & "</font>"
sEmailText = sEmailText & "</body>"
sEmailText = sEmailText & "</html>"
'create the mail object
Set NewMailObj=Server.CreateObject("CDONTS.NewMail")
NewMailObj.From=sEmail 'This is the email of the feedback sender
NewMailObj.To = "rkhetia@gmail.com" 'change to your address
NewMailObj.Subject = "Feedback"
NewMailObj.Body = sEmailText
'you need to add these 2 lines for the mail to be sent in HTML format
'remove them and the email will be sent in Text format
NewMailObj.BodyFormat = 0
NewMailObj.MailFormat = 0
NewMailObj.Send
Set NewMailObj=Nothing
Response.write "<div align='center'>Thank you for sending your feedback.<br>"
Response.write "We will get back to you if necessary.</div>"
End If
%>
</body>
</html>
- <%
- '==========================================================
- ' Codefixer's Feedback Form
- 'http://www.codefixer.com/codesnippets/feedbackform.asp
- 'You may wish to add client side and server side validation
- '==========================================================
- %>
- <html>
- <head>
- <title>Feedback Form</title>
- </head>
- <body bgcolor="#FFFFFF">
- <%
- If Request.Form="" Then %>
- <form method="post" action="feedback.asp" name="form1">
- <div align="center">Send us your Feedback.<br>
- <br>
- </div>
- <div align="center">
- <table width="75%" border="0">
- <tr>
- <td>Name</td>
- <td>
- <input type="text" name="txtName">
- </td>
- </tr>
- <tr>
- <td>E-mail</td>
- <td>
- <input type="text" name="txtEmail">
- </td>
- </tr>
- <tr>
- <td>Comment</td>
- <td>
- <textarea name="txtFeedback" cols="40" rows="7"></textarea>
- </td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td> </td>
- <td>
- <input type="submit" name="Submit" value="Submit">
- <input type="reset" name="Reset" value="Reset">
- </td>
- </tr>
- </table>
- </div>
- </form>
- <br>
- <%
- Else
- 'receive the form values
- Dim sName, sEmail, sFeedback
- sName=Request.Form("txtName")
- sEmail=Request.Form("txtEmail")
- sFeedback=Request.Form("txtFeedback")
- ' create the HTML formatted email text
- Dim sEmailText
- sEmailText = sEmailText & "<html>"
- sEmailText = sEmailText & "<head>"
- sEmailText = sEmailText & "<title>HTML Email</title>"
- sEmailText = sEmailText & "</head>"
- sEmailText = sEmailText & "<body>"
- sEmailText = sEmailText & "<font color='#00000' size='2' face='Verdana'>"
- sEmailText = sEmailText & "Feedback message from: " & sName & "<br>"
- sEmailText = sEmailText & "Message:" & sFeedback & "<br>"
- sEmailText = sEmailText & "Date & Time:" & Now() & "<br>"
- sEmailText = sEmailText & "IP :" & Request.ServerVariables("REMOTE_ADDR")
- sEmailText = sEmailText & "</font>"
- sEmailText = sEmailText & "</body>"
- sEmailText = sEmailText & "</html>"
- 'create the mail object
- Set NewMailObj=Server.CreateObject("CDONTS.NewMail")
- NewMailObj.From=sEmail 'This is the email of the feedback sender
- NewMailObj.To = "rkhetia@gmail.com" 'change to your address
- NewMailObj.Subject = "Feedback"
- NewMailObj.Body = sEmailText
- 'you need to add these 2 lines for the mail to be sent in HTML format
- 'remove them and the email will be sent in Text format
- NewMailObj.BodyFormat = 0
- NewMailObj.MailFormat = 0
- NewMailObj.Send
- Set NewMailObj=Nothing
- Response.write "<div align='center'>Thank you for sending your feedback.<br>"
- Response.write "We will get back to you if necessary.</div>"
- End If
- %>
- </body>
- </html>
However, when i upload this file onto my webpage, the actual code shows up!!
Check it out.. What is the issue??
Please help an asp n00b!