Try this, I haven't tested it but I think it will be ok.
Paul
<?php
function param($Name){
global $HTTP_POST_VARS;
if(isset($HTTP_POST_VARS[$Name])){return($HTTP_POST_VARS[$Name]);}
return("");
}
$from = param("from");
$to = param("to");
$cc = param("cc");
$bcc = param("bcc");
$subject = param("subject");
$body = param("body");
if($from != "" && $to != "" && $subject != "")
{
//create a boundary string. It must be unique
//so we use the MD5 algorithm to generate a random hash
$random_hash = md5(date('r', time()));
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: $from\r\nReply-To: $from";
//add boundary string and mime type specification
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";
//define the body of the message.
ob_start(); //Turn on output buffering
}
?>
--PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hello World!!!
This is simple text email message.
--PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
<?= $body ?>
--PHP-alt-<?php echo $random_hash; ?>--
<?php
if($from != "" && $to != "" && $subject != "")
{
//copy current buffer contents into $message variable and delete current output buffer
$message = ob_get_clean();
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
echo $mail_sent ? "Mail sent" : "Mail failed";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello!</title>
<script type="text/javascript" src="../fckeditor/fckeditor.js"></script>
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( 'body' ) ;
oFCKeditor.BasePath = "/fckeditor/" ;
oFCKeditor.ReplaceTextarea() ;
}
</script>
</head>
<body>
<form name="email" method="post" action="<?= $PHP_SELF ?>">
<table align="center">
<tr>
<td>from</td>
<td align="right"><input type="text" size="60" name="from" /></td>
</tr>
<tr>
<td>to</td>
<td align="right"><input type="text" size="60" name="to" /></td>
</tr>
<tr>
<td>cc</td>
<td align="right"><input type="text" size="60" name="cc" /></td>
</tr>
<tr>
<td>bcc</td>
<td align="right"><input type="text" size="60" name="bcc" /></td>
</tr>
<tr>
<td>subject</td>
<td align="right"><input type="text" size="60" name="subject" /></td>
</tr>
<tr>
<td colspan="2">
<textarea id="body" name="body"></textarea>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="submit" value="send" />
</td>
</tr>
</table>
</form>
</body>
</html>