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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| <?
// ADRESSE DU DESTINATAIRE
$to="xxxxxx@gmail.com";
//
// SUJET DU MESSAGE
$sujet=".Message.";
// ENTETES
$entetes="From:$nom $prenom<info@coco-photocop.fr>\r\n";
// MESSAGE
$msg.="\nNom : $nom\n";
$msg.="E mail : $mail\n";
$msg.="\nMessage :\n\n$message";
$msg = stripslashes($msg);
if (is_uploaded_file($attach)) {
$file = fopen($attach, "r");
$contents = fread($file, $attach_size);
$encoded_attach = chunk_split(base64_encode($contents));
fclose($file);
if (is_uploaded_file($attach2)) {
$file2 = fopen($attach2, "r");
$contents2 = fread($file2, $attach_size2);
$encoded_attach2 = chunk_split(base64_encode($contents2));
fclose($file2);
$entetes.= "MIME-version: 1.0\n";
$entetes.= "Content-type: multipart/mixed; ";
$entetes.= "boundary=\"Message-Boundary\"\n";
$entetes.= "Content-transfer-encoding: 7BIT\n";
$body_top = "--Message-Boundary\n";
$body_top .= "Content-type: text/plain; charset=US-ASCII\n";
$body_top .= "Content-transfer-encoding: 7BIT\n";
$body_top .= "Content-description: Mail message body\n\n";
$msg .= "\n\n--Message-Boundary\n";
$msg .= "Content-type: $attach_type; name=\"$attach_name\"\n";
$msg .= "Content-Transfer-Encoding: BASE64\n";
$msg .= "Content-disposition: attachment; filename=\"$attach_name\"\n\n";
$msg .= "$encoded_attach\n";
$msg .= "--Message-Boundary--\n";
}
$msg = $body_top.stripslashes($msg);
if (mail($to,$sujet,$msg,$entetes))
{ ... |
Partager