#!/usr/bin/python

import cgi
import smtplib
import sys




c = cgi.FieldStorage()

if 'email' in c and 'message' in c:
  server = smtplib.SMTP('localhost')
  msg = """From: information@hemaka.com
To: wes@terray.com
Subject: Hey Wes... someone filled out the form!

Hey Wes this is Hemaka! Guess what... someone filled out our contact email form!

Name: Web User
Email: %s
Message: %s

""" % (c['email'].value, c['message'].value)
  server.sendmail('information@hemaka.com', ['wes@terray.com'], msg)
  print """Location: contact2.html\n"""
  sys.exit()



print """Content-type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> WesTerray.com - Contact </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<SCRIPT>
function openPopup() {
        open("lev_preview_popup.html", "popup", "width=621,height=314,status=no,toolbar=no,menubar=no,screenX=25,screenY=50,resizable=no,scrollbars=no");
}
function openPopup2() {
        open("lev_preview_popup.html", "popup", "width=621,height=314,status=no,toolbar=no,menubar=no,screenX=25,screenY=50,resizable=no,scrollbars=no");
}
</SCRIPT>
<STYLE>
.header {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px; color: #FFECBF; text-decoration: none;
}
a.header, a.header:visited {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px; color: #FFECBF; text-decoration: none; font-weight: bold
}
a.header:hover, a.header:active {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px; color: #FE0000; text-decoration: none; font-weight: bold
}
.bodytext {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px; color: #000000; text-decoration: none;
}
a.bodytext, a.bodytext:visited {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px; color: #FE0000; text-decoration: underline;
}
a.bodytext:hover, a.bodytext:active {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px; color: #FE0000; text-decoration: underline;
}
.sub1 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px; color: #444136; text-decoration: none;
}
a.sub1, a.sub1:visited {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px; color: #FE0000; text-decoration: none; font-weight: bold
}
a.sub1:hover, a.sub1:active {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px; color: #FE0000; text-decoration: none; font-weight: bold
}
.title {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 16px; color: #444136; text-decoration: none;
}
.subtitle {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px; color: #444136; text-decoration: none;
}
</STYLE>
</HEAD>

<BODY MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 BORDER=0>

<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=810 ALIGN=CENTER>
  <TR>
    <TD VALIGN=TOP COLSPAN=6><IMG SRC="images/spacer.gif" WIDTH="1" HEIGHT="20" BORDER="0" ALT=""></TD>
  </TR>
  <TR>
    <TD VALIGN=TOP BGCOLOR="#444136" COLSPAN=6><IMG SRC="images/spacer.gif" WIDTH="810" HEIGHT="20" BORDER="0" ALT=""></TD>
  </TR>
  <TR>
    <TD VALIGN=TOP BGCOLOR="#444136"><IMG SRC="images/spacer.gif" WIDTH="20" HEIGHT="50" BORDER="0" ALT=""></TD>
	<TD VALIGN=TOP BGCOLOR="#C49503"><A HREF="../index.html"><IMG SRC="images/lev_logo.gif" WIDTH="178" HEIGHT="50" BORDER="0" ALT="WesTerray.com"></A></TD>
	<TD VALIGN=TOP BGCOLOR="#444136"><IMG SRC="images/spacer.gif" WIDTH="8" HEIGHT="50" BORDER="0" ALT=""></TD>
    <TD VALIGN=TOP BGCOLOR="#93703D"><IMG SRC="images/spacer.gif" WIDTH="100" HEIGHT="7" BORDER="0" ALT=""><br><IMG SRC="images/spacer.gif" WIDTH="13" HEIGHT="1" BORDER="0" ALT=""><A HREF="contact.py" class=header>contact</A></TD>
	<TD VALIGN=TOP BGCOLOR="#93703D" ALIGN=RIGHT><font class=header><IMG SRC="images/spacer.gif" WIDTH="484" HEIGHT="7" BORDER="0" ALT=""><br>major projects:&nbsp;&nbsp;&nbsp;<A HREF="http://www.westerray.com/index.html" class=header>boxworld</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="leverage_overview.html" class=header>leverage</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="garage_overview.html" class=header>the unmarked garage</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="popsicle_overview.html" class=header>the popsicle girl</A><IMG SRC="images/spacer.gif" WIDTH="13" HEIGHT="1" BORDER="0" ALT=""><br>
	<IMG SRC="images/spacer.gif" WIDTH="1" HEIGHT="2" BORDER="0" ALT=""><br>
	<A HREF="other.html" class=header>streaming video and other media</A><IMG SRC="images/spacer.gif" WIDTH="13" HEIGHT="1" BORDER="0" ALT=""></TD>
	<TD VALIGN=TOP BGCOLOR="#444136"><IMG SRC="images/spacer.gif" WIDTH="20" HEIGHT="50" BORDER="0" ALT=""></TD>
  </TR>
  <TR>
    <TD VALIGN=TOP BGCOLOR="#444136" COLSPAN=6><IMG SRC="images/spacer.gif" WIDTH="810" HEIGHT="9" BORDER="0" ALT=""></TD>
  </TR>
  <TR>
    <TD VALIGN=TOP BGCOLOR="#444136"><IMG SRC="images/spacer.gif" WIDTH="20" HEIGHT="83" BORDER="0" ALT=""></TD>
	<TD VALIGN=TOP BGCOLOR="#FBF7C8" COLSPAN=4><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=770>
	  <TR>
	    <TD VALIGN=TOP ROWSPAN=3 BGCOLOR="#FBF7C8"><IMG SRC="images/spacer.gif" WIDTH="17" HEIGHT="83" BORDER="0" ALT=""></TD>
        <TD VALIGN=TOP COLSPAN=3 BGCOLOR="#FBF7C8"><IMG SRC="images/spacer.gif" WIDTH="740" HEIGHT="1" BORDER="0" ALT=""></TD>
		<TD VALIGN=TOP ROWSPAN=3 BGCOLOR="#FBF7C8"><IMG SRC="images/spacer.gif" WIDTH="13" HEIGHT="83" BORDER="0" ALT=""></TD>
	  </TR>
      <TR>
		<TD VALIGN=BOTTOM ALIGN=LEFT BGCOLOR="#FBF7C8"><font class=title><b>Contact Me</b></font></TD>
		<TD VALIGN=BOTTOM BGCOLOR="#FBF7C8"><IMG SRC="images/spacer.gif" WIDTH="1" HEIGHT="72" BORDER="0" ALT=""></TD>
		<TD VALIGN=BOTTOM ALIGN=RIGHT BGCOLOR="#FBF7C8"><font class=sub1><!--MORE:<br>
		<A HREF="http://www.apple.com/downloads/macosx/apple/quicktime652forwindows.html" class=sub1 target="_blank">download new quicktime 6.5 (windows) for free</A><br>
		<A HREF="http://www.apple.com/downloads/macosx/apple/quicktime702.html" class=sub1 target="_blank">download new quicktime 7.0 (mac) for free</A><br>
		<A HREF="http://www.winamp.com/player/free.php" class=sub1 target="_blank">download the free winamp 5.1 player for audio files--></TD>
      </TR>
      <TR>
		<TD VALIGN=TOP COLSPAN=3 BGCOLOR="#FBF7C8"><IMG SRC="images/spacer.gif" WIDTH="740" HEIGHT="10" BORDER="0" ALT=""></TD>
      </TR>
    </TABLE></TD>
	<TD VALIGN=TOP BGCOLOR="#444136"><IMG SRC="images/spacer.gif" WIDTH="20" HEIGHT="83" BORDER="0" ALT=""></TD>
  </TR>
  <TR>
    <TD VALIGN=TOP BGCOLOR="#444136" COLSPAN=6><IMG SRC="images/spacer.gif" WIDTH="810" HEIGHT="9" BORDER="0" ALT=""></TD>
  </TR>
  <TR>
    <TD VALIGN=TOP BGCOLOR="#444136"><IMG SRC="images/spacer.gif" WIDTH="20" HEIGHT="83" BORDER="0" ALT=""></TD>
	<TD VALIGN=TOP BGCOLOR="#FFECBF" COLSPAN=4><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=770>
      <TR>
        <TD VALIGN=TOP BGCOLOR="#444136"><IMG SRC="images/wes_cover.jpg" WIDTH="301" HEIGHT="401" BORDER="0" ALT="Wes Terray"></TD>
		<TD VALIGN=TOP BGCOLOR="#444136"><IMG SRC="images/spacer.gif" WIDTH="8" HEIGHT="50" BORDER="0" ALT=""></TD>
		<TD VALIGN=TOP BGCOLOR="#FFECBF"><IMG SRC="images/spacer.gif" WIDTH="15" HEIGHT="10" BORDER="0" ALT=""></TD>
		<TD VALIGN=TOP BGCOLOR="#FFECBF"><font class=bodytext><IMG SRC="images/spacer.gif" WIDTH="420" HEIGHT="17" BORDER="0" ALT=""><br><FORM method='post' >All manner of questions or comments are welcome, so write and let me know what's on your mind.  By submitting your email address below, you are not signing up for anything (no newsletters, no spam, no solicitation).  All you will receive is a response.  Thank you.
		<br>&nbsp;<br>
		<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 ALIGN=CENTER>
		<TR>
		<TD VALIGN=TOP ALIGN=RIGHT><font class=bodytext>Your email address:</TD>
		<TD VALIGN=TOP><font class=bodytext>&nbsp;&nbsp;</TD>
        <TD VALIGN=TOP><font class=bodytext><INPUT TYPE=text size=33 name=email class=bodytext><br>&nbsp;</TD>
		</TR>
		<TR>
        <TD VALIGN=TOP ALIGN=RIGHT><font class=bodytext>Message:</TD>
		<TD VALIGN=TOP><font class=bodytext>&nbsp;&nbsp;</TD>
        <TD VALIGN=TOP><font class=bodytext><TEXTAREA ROWS=8 COLS=30 NAME=message class=bodytext></TEXTAREA></TD>
		</TR>
		<TR>
        <TD VALIGN=TOP ALIGN=RIGHT><font class=bodytext>&nbsp;&nbsp;</TD>
		<TD VALIGN=TOP><font class=bodytext>&nbsp;&nbsp;</TD>
        <TD VALIGN=TOP><font class=bodytext>&nbsp;<br><input type=submit value="Send Message" class=bodytext></TD>
		</TR>
		</TABLE>
		&nbsp;<br>&nbsp;</FORM></TD>
		<TD VALIGN=TOP BGCOLOR="#FFECBF"><IMG SRC="images/spacer.gif" WIDTH="26" HEIGHT="10" BORDER="0" ALT=""></TD>
      </TR>
    </TABLE></TD>
	<TD VALIGN=TOP BGCOLOR="#444136"><IMG SRC="images/spacer.gif" WIDTH="20" HEIGHT="83" BORDER="0" ALT=""></TD>
  </TR>
  <TR>
    <TD VALIGN=TOP BGCOLOR="#444136" COLSPAN=6><IMG SRC="images/footer.gif" WIDTH="810" HEIGHT="20" BORDER="0" ALT="(c)2005 TASC.  All rights reserved."></TD>
  </TR>
</TABLE>
&nbsp;<br>&nbsp;

</BODY>
</HTML>
"""
