J'ai acheté un formulaire d'envoi de mail flash/php sur un site commercial. Je n'y connais rien en php, je ne comprend donc pas d'où vient le problème. Je reçois bien les mails envoyés via le formulaire, mais quand ils arrivent dans ma boite lettre, les informations du header sont précédés de ça :
""> TEXTFORMAT LEADING=\ "2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Eurostile\" SIZE=\"16\" COLOR=\"#FFFFFF\" LETTERSPACING=\"0\" KERNING=\"0\">[email protected]</FONT></P></TEXTFORMAT>"
De plus, tout ce qui est récupéré de mon formulaire apparait en taille énorme sur le mail.
Voici le code php :
<?php
$newfile = $_POST['uploadfile'];
$fileatt = "Uploads/" . $newfile; // Path to the folder of attached file
$fileatt_type = "application/octet-stream"; // File Type
$fileatt_name = $_POST['uploadfile'];; // Filename that will be used for the file as an attachement
$from = $_POST['email']; // email of sender
$email_from = $from; // name of mail sender
$email_subject = $_POST['subject']; // The Subject of the email
$email_txt = "Message de la part de : " . $_POST['name'] . "<br></br>" . $_POST['message']; // Message that the email has in it
$email_to = "[email protected]"; // set here your email address
$headers = "From: ".$email_from;
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$email_message .= $email_txt . "\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_txt . "\n\n";
$data = chunk_split(base64_encode($data));
$email_message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
$ok = @mail($email_to, $email_subject, $email_message, $headers);
unlink("http://affichage-grand-format.fr/usr/lib/php.ini ".$_POST['uploadfile']); // this is a long path, not http://www.yoursite.com or http://www.yoursite.com ask your host for this path if you can't find it on your control panel
?>
Quelqu'un peut-il m'aider? Merci d'avance pour votre aide!!