<HTML><BODY onload="document.MyForm.Password.focus()">


<!-- 
Sending HTML email. 

Large emails are not recommended with the mail function. We'll use 
another way in the future.

Emails with attachments, forwarding emails, etc, will 
be covered later.
-->

<?php


if (isset($_POST['submitted'])) // If the form is submitted
{
	$errors = array();
        $password = stripslashes(trim($_POST['Password']));
        if ($password == "fenton")
        {
                $from = stripslashes(trim($_POST['From']));
                $email = trim($_POST['Email']);
                $to = trim($_POST['To']);
                $cc = trim($_POST['Cc']);
                $subject = stripslashes(trim($_POST['Subject']));
                $body = stripslashes(trim($_POST['Body']));
		/* For HTML Emails (you put the HTML source code in the 
			body) */
		$headers ='MIME-Version: 1.0'."\r\n";
		$headers.='Content-type:text/html;charset=iso-8859-1'."\r\n";
                $headers .= "From: $from <$email>\r\n";
		$headers .= "To: $to\r\n";
                $headers .= "CC: $cc\r\n";
		if (empty($email))
			$errors[] = "You have to enter your email address.";
		if (empty($to))
                        $errors[] = "You have to enter the email address of the recipient.";
		if (empty($errors)) // send the email
		{
	               mail($to,$subject,$body, $headers);
        	        echo "<P align=center>Your email has been sent.<P>\n";
		}
		else //display the errors
		{
			echo "<h1 align=center>ERROR</h1><center>\n";
			foreach ($errors as $e)
				echo $e, "<P>\n";
			echo "</center>\n";
		}
        }
	else
		echo "<P align=center>Wrong Password<P>\n";
}

else //display the form
{

	echo <<< Begin

	<TABLE WIDTH=80% ALIGN=center><TR><TD>
	
	<FORM ACTION="{$_SERVER['PHP_SELF']}" METHOD="POST" NAME="MyForm">
	<h1 align=center> Sending Email</h1>
	<table width=100%><tr>
	<td width=20% align=right><B>Password</B></td>
	<td width=80%>
	<INPUT NAME="Password" SIZE=70 type="password" 
style="width:100%">
	</td>
	</tr></table>

	<table width=100%><tr>
        <td width=20% align=right><B>From</B></td>
	<td width=80%>
	<INPUT NAME="From" SIZE=70 style="width:100%">
	</td>
	</tr></table>

	<table width=100%><tr>
        <td width=20% align=right>
	<B>Your Email</B>
	</td>
	<td width=80%>
	<INPUT NAME="Email" SIZE=70 style="width:100%">
	</td>
	</tr></table>
	
	<table width=100%><tr>
        <td width=20% align=right>
	<B>To</B>
	</td>
	<td width=80%>
	<TEXTAREA NAME="To" ROWS="1" COLS="70" style="width:100%;overflow-y:auto;">
	</TEXTAREA>
	</td>
	</tr></table>
	
	<table width=100%><tr>
        <td width=20% align=right>
	<B>CC</B>
	</td>
	<td width=80%>
	<TEXTAREA NAME="Cc" rows="1" cols="70"
	wrap="virtual" style="width:100%; overflow-y:auto">
	</TEXTAREA>
	</td>
	</tr></table>

	<table width=100%><tr>
        <td width=20% align=right>
	<B>Subject</B>
	</td>
	<td width=80%>
	<INPUT NAME="Subject" SIZE=70 style="width:100%">
	</td>
	</tr></table>
	
	<INPUT type="hidden" name="submitted" value="TRUE">
	
	<table width=100%><tr>
        <td width=20% align=right>
	</td>
	<td width=80%>
	<TEXTAREA NAME="Body" ROWS=12 COLS=70 WRAP="virtual" 
style="width:100%; overflow-y:auto;">
	</TEXTAREA>
	</td>
	</tr></table>

	<table width=100%><tr>
	<td width=20%></td>
	<td width=80%>
	<INPUT TYPE="submit" VALUE="SUBMIT">
	<INPUT TYPE="reset" VALUE="CLEAR">
	</td>
	</tr></table>

	</FORM>
	</TD></TR></TABLE>

Begin;
}

?>
</BODY></HTML>
