In the following example, we will use the built-in mail() function, where, as parameters, client data will be transmitted via a $_POST request.
<?php
if ($_POST['submit'])
{
$from = $_POST['from'];
$to = $_POST['to'];
$subject = $_POST['subj'];
$message = $_POST['msg'];
$headers = "From: $from\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/plain; charset=windows-1251\r\n"."Content-Transfer-Encoding: 8bit\r\n";
mail($to, "=?windows-1251?B?".base64_encode($subject)."?=", $message, $headers, "-f ".$from);
}
?>
<form action="" method="post">
<pre>
From: <input type="text" name="from">
To: <input type="text" name="to">
Subj: <input type="text" name="subj">
Msg: <input type="text" name="msg">
<input type="submit" value="Send mail!" name="submit">
</pre>
</form>