1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| $delim = md5(uniqid(rand()));
$head = "MIME-Version: 1.0\n";
$head .= "Content-type: multipart/mixed; boudary=\"$delim\"\n";
$head .= "\n";
$attache = file_get_contents($destination);
$attache = chunk_split(base64_encode($attache));
$sujet = $_POST['sujet'];
$adr = $_POST['from'];
$de = "Reply-to:\"$adr\"\nfrom: Newsletter";
$message = $_POST['message'];
$msg = "<HTML><BODY>" .$message ."</BODY></HTML>";
$msg = stripslashes($msg);
$html = "Ce message demande MIME pour être lu \n ";
$html .= "\n";
$html = "--$delim\n";
$html .= "Content-type: text/html; charset=\"iso-8859-1\" \n";
$html .= "Content-Transfer-Encoding: quoted-printable \n";
$html .= "Content-Disposition: inline \n ";
$html .= $msg ." \n\n ";
$html .= "--$delim \n";
$html .= "Content-type: $mime; name=\"$nomFichierJoint\"\n";
$html .= "Content-transfer-Encoding: base64\n";
$html .= "Content-Disposition: inline; filename=\"$nomFichierJoint\"\n";
$html .= "\n";
$html .= $attache ."\n";
$html .= "\n";
$entete = $head;
mail('adresse@mail.fr', $sujet, $html, $de ."\n" .$entete); |
Partager