<html>
<head>
  <title>Feedback Form</title>
</head>

<body>

<%
' If the form has not been submitted
If Request.Form="" Then %>
<form method="post" action="feedback.asp" name="form1">
<div align="center"><b>Send us your Feedback.</b><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>Message:</td>
  <td><textarea name="txtFeedback" cols="40" rows="7"></textarea></td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td>
  <input type="submit" name="Submit" value="Submit">
  <input type="reset" name="Reset" value="Reset">
  </td>
</tr>
</table>
</div>
</form>
<br>

<%
' If the form has been submitted execute the following code
Else

' get the form values
Dim sName, sEmail, sFeedback
sName = Request.Form("txtName")
sEmail = Request.Form("txtEmail")
sFeedback = Request.Form("txtFeedback")

' create the HTML formatted email message text
Dim sEmailText
sEmailText = sEmailText & "<html>"
sEmailText = sEmailText & "<head>"
sEmailText = sEmailText & "<title>Message</title>"
sEmailText = sEmailText & "</head>"
sEmailText = sEmailText & "<body>"
sEmailText = sEmailText & "<font size='2' face='Arial'>"
sEmailText = sEmailText & "Message from: " & sName & "<br>"
sEmailText = sEmailText & "Message text:" & sFeedback & "<br>"
sEmailText = sEmailText & "Date and time:" & Now() & "<br>"
sEmailText = sEmailText & "IP address:" & Request.ServerVariables("REMOTE_ADDR")
sEmailText = sEmailText & "</font>"
sEmailText = sEmailText & "</body>"
sEmailText = sEmailText & "</html>"


' the mail is sent via CDONTS object
Set NewMailObj=Server.CreateObject("CDONTS.NewMail")
NewMailObj.From=sEmail 'This is the email of the feedback sender
NewMailObj.To = "michael@codefixer.com" 'change to your address
NewMailObj.Subject = "Feedback"
NewMailObj.Body = sEmailText
NewMailObj.BodyFormat = 0 ' remove this to send mail as text, not HTML
NewMailObj.MailFormat = 0 ' remove this to send mail as text, not HTML
NewMailObj.Send
Set NewMailObj=Nothing

' output thenk you message
Response.Write "<div align='center'>Thank you.</div>"
End If
%>

</body>
</html>

