PHP e-mail

Bonjour,
je voudrais que le code PHP si dessous soit envoyer a mon adresse e-mail (monemail@email.fr)
<html>
<body> <center>
<?

$name_file = $_FILES['monfichier']['name']; 
$source=$_FILES['monfichier']['tmp_name'];

move_uploaded_file($source, "./".$name_file); 

$extension=get_extension($name_file);

$type="text/plain";
if($type=="doc")
{
   $type="text/vnd.ms-word";
}
else if($type=="xls")
{
   $type="text/vnd.ms-excel";
}

$type2="image/png";

if($extension=="gif")
{
   $type2="image/gif";
}
else if($extension=="bmp")
{
   $type2="image/bmp";
}

function get_extension($filename)
{
   $parts = explode('.',$filename);
   $last = count($parts) - 1;
   $ext = $parts[$last];
   return $ext;
}

//----------------------------------
// Construction de l'entête
//----------------------------------

if($_POST['to']!="")
{
$boundary = "-----=".md5(uniqid(rand()));
$header = "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n";
$header .= "\r\n";

$msg = "Je vous informe que ceci est un message au format MIME 1.0 multipart/mixed.\r\n";

$msg .= "--$boundary\r\n";

$msg .= "Content-Type: $type; charset=\"iso-8859-1\"\r\n";
$msg .= "Content-Transfer-Encoding:8bit\r\n";
$msg .= "\r\n";
$msg .= $_POST['souhait'];
$msg .= "\r\n";
$msg .= $_POST['Experience'];
$msg .= "\r\n";
$msg .= $_POST['ville'];
$msg .= "\r\n";
$msg .= $_POST['prenom'];
$msg .= "\r\n";
$msg .= $_POST['NOM'];
$msg .= "\r\n";
$msg .= $_POST['email'];
$msg .= "\r\n";


if($name_file!="")
{
$file = $name_file;
$fp = fopen($file, "rb");  
$attachment = fread($fp, filesize($file));
fclose($fp);

$attachment = chunk_split(base64_encode($attachment));


$msg .= "--$boundary\r\n";
$msg .= "Content-Type: $type2; name=\"$file\"\r\n";
$msg .= "Content-Transfer-Encoding: base64\r\n";
$msg .= "Content-Disposition: inline; filename=\"$file\"\r\n";
$msg .= "\r\n";
$msg .= $attachment . "\r\n";
$msg .= "\r\n\r\n";
$msg .= "--$boundary--\r\n";
}

$destinataire = $_POST['to'];
$expediteur   = $_POST['from'];
$reponse      = $expediteur;
echo "Mail envoyé à $destinataire";

mail($destinataire, $_POST['sujet'], $msg,
     "Reply-to: $reponse\r\nFrom: $expediteur\r\n".$header);

}

if($name_file!="")
{
unlink($name_file);
}
print("<br>\n");
print("<br><A href=./mail3.php target=\"principal\"><font size=2>Envoyer un autre mail</font></A>");
?>
</center>
</body>
</html>




cordialment

1 réponse

  1. J'ai pas compris, tu veux te l'envoyer? Tu ne peux pas le faire autrement?
    Ou alors il ne te l'affiche pas correctement quand tu l'envoies?
    Si tel est le cas, ajoute <plaintext> au debut, et tout ce qui suit ne sera pas interprété et apparaitra comme tu l'as ecrit (normalement)