|
Below is the source for our Suggestions.asp
page, as discussed on the sendmail
component page. The server side scripting is in red. The page
is split into three areas using two if statements. Here's the
structure of the page:
<% If
Request("Content_Length") Then %>
process form
<% if objSMTP.SendMessage then %>
success message
<% Else %>
failure message
<% End If %>
<% Else %>
put up form
<% End If %>
The first if statement determines if we are processing the
results of a form or are to put the form up for the user to fill
out. The action= of the form (highlighted in fuschia below) points back to this page --
we use the same file to put up the form and to process the form.
The second if statement checks to see if the mail message was
sent ok, if so a success message is put up, else a failure
message. Here's the full source for suggestions.asp:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 2.0">
<title>Gregory Consulting - Suggestion Box</title>
<meta name="FORMATTER" content="Microsoft FrontPage 2.0">
</head>
<body stylesrc="home.html" background="images/back.gif"
bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080"
alink="#FF0000">
<p><!--webbot bot="HTMLMarkup" startspan -->
<% If Request("Content_Length") Then %>
<%
Set objSMTP = Server.CreateObject( "GCSMTP.GCSMTP.1" )
objSMTP.SMTPServer = "www.gregcons.com"
objSMTP.LocalDomain = "www.gregcons.com"
objSMTP.From = "WebServer@gregcons.com"
objSMTP.To = "suggest@gregcons.com"
objSMTP.FromName = "gregcons Suggestion Box"
objSMTP.ToName = "Suggestion Box"
objSMTP.Subject = "Suggestion From User"
objSMTP.Message = "Name: " & Request.Form("name") & vbCrLf &_
"Email: " & Request.Form("email") & vbCrLf &_
"Phone Number: " & Request.Form("phone") & vbCrLf &_
"Comment: " & Request.Form("comment") & vbCrLf &_
"Response: " & Request.Form("response") & vbCrLf
if objSMTP.SendMessage then %>
<!--webbot
bot="HTMLMarkup" endspan --></p>
<div align="left">
<table border="0">
<tr>
<td><img src="images/spacer.gif" width="150" height="1"></td>
<td><h2>Thank you for your Suggestions!</h2>
<p> </p>
<p>Your suggestions have been sent to <a
href="mailto:suggest@gregcons.com">suggest@gregcons.com</a></p>
<p>Return to the <a href="http://www.gregcons.com">Gregory
Consulting Home Page</a>.</p>
</td>
</tr>
</table>
</div>
<p><!--webbot bot="HTMLMarkup" startspan -->
<% Else %>
<!--webbot
bot="HTMLMarkup" endspan --></p>
<div align="left">
<table border="0">
<tr>
<td><img src="images/spacer.gif" width="150" height="1"></td>
<td><h2>Sorry, We are experiencing problems processing!</h2>
<p> </p>
<p>Please try again at a later time.</p>
<p>Return to the <a href="http://www.gregcons.com">Gregory
Consulting Home Page</a>.</p>
</td>
</tr>
</table>
</div>
<p><!--webbot bot="HTMLMarkup" startspan -->
<% End If %>
<% Else %>
<!--webbot
bot="HTMLMarkup" endspan --></p>
<table border="0">
<tr>
<td align="center" valign="top" rowspan="2"><a
href="home.html"><img src="images/home.gif" alt="Home"
border="0" width="150" height="70"></a><p><a
href="howto.htm"><img src="images/howto.gif"
alt="Building and Tools" border="0" width="150"
height="70"></a><br>
<a href="new.htm"><img src="images/new.gif" alt="New"
border="0" width="150" height="70"></a><a
href="whoarewe.htm"><br>
</a><a href="services.htm"><img src="images/services.gif"
alt="Services" border="0" width="150" height="70"></a><a
href="services.htm"><br>
</a><a href="whoarewe.htm"><img src="images/aboutgc.gif"
alt="About gregcons..." border="0" width="150"
height="70"></a><a href="whoarewe.htm"><br>
</a><a href="contact.htm"><img src="images/contact.gif"
alt="Contact Us" border="0" width="150" height="70"></a><a
href="contact.htm"><br>
</a><a href="contents.htm"><img src="images/contents.gif"
alt="Contents" border="0" width="150" height="70"></a><a
href="contents.htm"><br>
</a><img src="images/s_suggestion_box.gif" width="150"
height="70"> </p>
</td>
<td valign="top" rowspan="2"><!--webbot bot="Include"
u-include="i_header.htm" tag="BODY" startspan --><h1>GREGORY
CONSULTING</h1>
<!--webbot bot="Include" endspan i-checksum="4318" --><h1
align="center">Suggestion Box </h1>
<p>We are actively looking for comments and suggestions
from our readers. What else would you like to see on
these pages? You can use this form to let us know what
you think. Our <a href="contact.htm">contact page</a> has
other ways to reach us if you would prefer not to use the
form below or if your browser does not display it
properly. </p>
<p> </p>
<form action="suggestions.asp" method="POST">
<table border="0" cellspacing="10">
<tr>
<td align="right">Name:</td>
<td><input type="text" size="40"
maxlength="256" name="name"></td>
</tr>
<tr>
<td align="right">email:</td>
<td width="50%"><input type="text" size="40"
maxlength="256" name="email"></td>
</tr>
<tr>
<td align="right">Phone Number:</td>
<td><input type="text" size="40"
maxlength="256" name="phone"></td>
</tr>
<tr>
<td colspan="2"><textarea name="comment"
rows="8" cols="50"></textarea></td>
</tr>
<tr>
<td align="center" colspan="2"><select
name="response" size="1">
<option selected value="no response">No Response Required</option>
<option value="Response Requested">Response Requested</option>
</select></td>
</tr>
<tr>
<td align="center" colspan="2"><input
type="submit" value="Submit Comment"><input
type="reset" value="Clear Comment"></td>
</tr>
</table>
<p> </p>
</form>
<!--webbot bot="Include" u-include="i_footer.htm"
tag="BODY" startspan --><p> </p>
<hr>
<address>
Copyright <a href="contact.htm">Gregory Consulting</a>
Limited 1996,1997. All rights reserved.
</address>
<!--webbot bot="Include" endspan i-checksum="51685" --></td>
</tr>
</table>
<p><!--webbot bot="HTMLMarkup" startspan -->
<% End If %>
<!--webbot
bot="HTMLMarkup" endspan --></p>
</body>
</html>
|