Bonjour,
Voilà mon problème : j'arrive à envoyer une pièce jointe mais lorsque je veux en envoyer une deuxième dans le même mail ca ne marche pas.
Ca ne joint qu'un seul fichier ! Comment faire ?
Voici le bout de mon code traitant l'envoi du mail avec les pièces jointes :
$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: text/plain; charset=\"iso-8859-1\"\r\n";
$msg .= "Content-Transfer-Encoding:8bit\r\n";
$msg .= "\r\n";
$msg .= "Un client vient d'effectuer une réservation.";
$msg .= "\r\n";
$file0 = "contrat.pdf";
$file1 = "facture.pdf";
$fp0 = fopen($file0, "rb");
$fp1 = fopen($file1, "rb");
$attachment0 = fread($fp0, filesize($file0));
$attachment1 = fread($fp1, filesize($file1));
fclose($fp0);
fclose($fp1);
$attachment0 = chunk_split(base64_encode($attachment0));
$attachment1 = chunk_split(base64_encode($attachment1));
$msg .= "--$boundary\r\n";
$msg .= "Content-Type: pdf; name=\"$file0\"\r\n";
$msg .= "Content-Type: pdf; name=\"$file1\"\r\n";
$msg .= "Content-Transfer-Encoding: base64\r\n";
$msg .= "Content-Disposition: attachement; filename=\"$file0\"\r\n";
$msg .= "Content-Disposition: attachement; filename=\"$file1\"\r\n";
$msg .= "\r\n";
$msg .= $attachment0."\r\n";
$msg .= $attachment1."\r\n";
$msg .= "\r\n\r\n";
$msg .= "--$boundary--\r\n";
$destinataire = "crivelli.lucas@gmail.com";
$expediteur = "info@easy-park.ch";
$reponse = $expediteur;
$sujet = "Rapport de réservation";
mail($destinataire, $sujet, $msg,"Reply-to: $reponse\r\nFrom: ".$expediteur."\r\n".$header);<code></code>
mais ca ne marche pas.
merci pour votre aide...Configuration: Mac OS X
Safari 525.27.1

