par
Agape » 07 juil. 2013, 18:00
Merci , j'ai refais des tests sans succes, du coup j'suis parti sur un script qui m'affiche le nom de la pièce jointe dans "la partie pièce jointe du mail" reçu.
Avec le bon poids... donc c'est mieux....mais j'ai juste un souci, la pièce jointe est corrompu, donc inexploitable :
Voici mon code :
************************
$acte = $_FILES["acte"]["name"];
$boundary =rand(0,9)."-" .rand(10000000000,9999999999) . "-" . rand(10000000000,9999999999)."=:" . rand(10000,99999);
$attached_file = file_get_contents($acte); //file name ie: ./image.jpg
$attached_file = chunk_split(base64_encode($attached_file));
$attached = "\n\n". "--" .$boundary . "\nContent-Type: application; name=\"".$_FILES["acte"]["name"]."\"\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"".$_FILES["acte"]["name"]."\"\r\n\n".$attached_file . "--" . $boundary . "--";
$headers ="From:
[email protected]\r\n";
$headers .= "MIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"".$boundary."\"\r\n";
$sujetMail = "Sujet";
//Les variables
$subject = "Formulaire TEST";
$message .="<html><body>Nom / Prenom : ".$_POST["nom"]." ".$_POST["prenom"]."<br />";
$message .="Telephone : ".$_POST["telephone"]."</span><br />";
$message .="Email : ".$_POST["email"]."</span><br />";
$message .="Sujet : ".$_POST["sujet"]."</span><br />";
$message .="Langue :".$_POST["LgTemp"]."</span><br />";
$message .="Message :<br />".nl2br($_POST["comment"])."<br />";
$message .="</body></html>";
$message2 = utf8_decode($message);
$body = "--". $boundary ."\nContent-Type: text/html; charset=ISO-8859-1\r\n\n".$message2 . $attached;
if (mail ("monmail","TEST BODY", $body, $headers ))
{
$msg = "Votre demande va être traitée...<br>Vous serez contacté prochainement par nos services\n...";
}
*****************************************
*****************************************
Connais tu le moyen de rendre NON CORROMPU cette pièce jointe ?
Merci , j'ai refais des tests sans succes, du coup j'suis parti sur un script qui m'affiche le nom de la pièce jointe dans "la partie pièce jointe du mail" reçu.
Avec le bon poids... donc c'est mieux....mais j'ai juste un souci, la pièce jointe est corrompu, donc inexploitable :
Voici mon code :
************************
$acte = $_FILES["acte"]["name"];
$boundary =rand(0,9)."-" .rand(10000000000,9999999999) . "-" . rand(10000000000,9999999999)."=:" . rand(10000,99999);
$attached_file = file_get_contents($acte); //file name ie: ./image.jpg
$attached_file = chunk_split(base64_encode($attached_file));
$attached = "\n\n". "--" .$boundary . "\nContent-Type: application; name=\"".$_FILES["acte"]["name"]."\"\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"".$_FILES["acte"]["name"]."\"\r\n\n".$attached_file . "--" . $boundary . "--";
$headers ="From:
[email protected]\r\n";
$headers .= "MIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"".$boundary."\"\r\n";
$sujetMail = "Sujet";
//Les variables
$subject = "Formulaire TEST";
$message .="<html><body>Nom / Prenom : ".$_POST["nom"]." ".$_POST["prenom"]."<br />";
$message .="Telephone : ".$_POST["telephone"]."</span><br />";
$message .="Email : ".$_POST["email"]."</span><br />";
$message .="Sujet : ".$_POST["sujet"]."</span><br />";
$message .="Langue :".$_POST["LgTemp"]."</span><br />";
$message .="Message :<br />".nl2br($_POST["comment"])."<br />";
$message .="</body></html>";
$message2 = utf8_decode($message);
$body = "--". $boundary ."\nContent-Type: text/html; charset=ISO-8859-1\r\n\n".$message2 . $attached;
if (mail ("monmail","TEST BODY", $body, $headers ))
{
$msg = "Votre demande va être traitée...<br>Vous serez contacté prochainement par nos services\n...";
}
*****************************************
*****************************************
Connais tu le moyen de rendre NON CORROMPU cette pièce jointe ?