try this form. download the libmail class, and put the file
in the same directory that you have the form in.
<?php
if(isset($_POST['submit'])){
//upload the attached file
include "libmail.php";
$m= new Mail; // create the mail
$m->From($_POST['email']);
$m->To($_POST['recipient']);
$m->Subject($_POST['subject']);
$m->Body($_POST['message']); // set the body
//$m->Cc( "someone@somewhere.fr");
//$m->Bcc( "someoneelse@somewhere.fr");
$m->Priority(4) ; // set the priority to Low
if(is_uploaded_file($_FILES['file_attachment']['tmp_name'])){
move_uploaded_file($_FILES['file_attachment']['tmp_name'],
basename($_FILES['file_attachment']['name']));
$m->Attach($_FILES['file_attachment']['name']) ; //
attach a file
}
$m->Send(); // send the mail
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form action="email.php" method="post"
enctype="multipart/form-data" name="frm_mail" id="frm_mail">
<table width="550" border="0" cellspacing="1"
cellpadding="2">
<tr>
<td colspan="2">
<?php if (isset($_POST['submit'])){
echo 'your message was successfully sent to '.
$_POST['recipient'].
' thanks!';
}
?>
</td>
</tr>
<tr>
<td colspan="2"><h1>Email recipient
</h1></td>
</tr>
<tr>
<td width="150"><p>Send message to:
</p></td>
<td><label>
<input type="text" name="recipient" />
</label></td>
</tr>
<tr>
<td colspan="2"><h1>Sender</h1></td>
</tr>
<tr>
<td><p>e-mail address: </p></td>
<td><input name="email" type="text"
id="email"></td>
</tr>
<tr>
<td><p>subject:</p></td>
<td><input name="subject" type="text" id="subject"
size="50"></td>
</tr>
<tr>
<td
colspan="2"><h1>Message</h1></td>
</tr>
<tr>
<td><p>Attachment</p></td>
<td>
<input name="file_attachment" type="file" id="this"
size="31">
</td>
</tr>
<tr>
<td colspan="2"><textarea name="message" cols="57"
rows="12" id="message"></textarea></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Send
Message"></td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
One thing,
I cut out a lot of things from this form, so if you have any
problems let me know.