From: ***@***
To:
Date: Sun, 22 Dec 2013 22:24:04 +0100
Subject: test
This is a multi-part message in MIME format.
--56cb8620624e6641bbe66343a30b06c0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: binary
teste
--56cb8620624e6641bbe66343a30b06c0
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding:binary
teste<br>
--56cb8620624e6641bbe66343a30b06c0
Content-type: file;name="Affiche fete noel 2013.pdf"
Content-transfer-encoding:base64
Content-Disposition: attachment; filename="Affiche fete noel 2013.pdf"
JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFu
Zyhmci1GUikgL1N0cnVjdFRyZWVSb290IDgwIDAgUi9NYXJrSW5mbzw8L01hcmtlZCB0cnVlPj4v
UGFnZUxhYmVscyAxMTAgMCBSPj4NCmVuZG9iag0KMiAwIG9iag0KPDwvVHlwZS9QYWdlcy9Db3Vu
dCAxL0tpZHNbIDMgMCBSXSA+Pg0KZW5kb2JqDQozIDAgb2JqDQo8PC9UeXBlL1BhZ2UvUGFyZW50
IDIgMCBSL1Jlc291cmNlczw8L1hPYmplY3Q8PC9JbWFnZTUgNSAwIFIvSW1hZ2U3IDcgMCBSL0lt
<<je raccourci ici>>
bGVyDQo8PC9TaXplIDExMi9Sb290IDEgMCBSL0luZm8gNzkgMCBSL0lEWzw0Q0JDMUJDREM1NzU3
OTQ0QUY5MERCMEY4OTMwMkU0MD48NENCQzFCQ0RDNTc1Nzk0NEFGOTBEQjBGODkzMDJFNDA+XSAv
UHJldiA3NjczMTMvWFJlZlN0bSA3NjY3NjE+Pg0Kc3RhcnR4cmVmDQo3Njk3MTMNCiUlRU9G
--56cb8620624e6641bbe66343a30b06c0--
end of the multi-part
$boundary = "-----=" . md5(uniqid(rand())); // création aléatoire des frontieres boundaryenvoies toi un email sur une fauuse adresse et un reply sur ton adresse email
$rn= "\r\n";
$headers .= "From:" . $email_exp . $rn;
$headers .= "To:".$email_dest.$rn;
$headers .= "X-Priority:" . $email_priorite . $rn;//ok
$headers .= "Cc:" . $email_cc . $rn;
$headers .= "Bcc:".$email_bcc.$rn;
$headers .= "Reply-to:" . $reply_email . $rn;//ok
$headers .= "Priority:".$email_priorit . $rn;//ok
$headers .= "X-Mailer: PHP v" . phpversion() . $rn;//ok
$headers .= "X-Originating-IP: [" . getenv("REMOTE_ADDR") . "]" . $rn;//ok
$headers .= "X-Sender-IP: " . $_SERVER["REMOTE_ADDR"] . $rn; //ok
$headers .= "X-Confirm-Reading-To:" . $email_exp . $rn; //confirmation de lecture ok
$headers .= "Delivery-date: " . date("D, j M Y H:i:s " . $timezone) . $rn;//ok
$headers .= 'MIME-Version: 1.0' . $rn;
$headers .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . $rn;
$headers .= $rn; //rajouter ?
//======================= Ouverture de Boundary=============================
$message = 'This is a multi-part message in MIME format.' . $rn;
//message .= "--$boundary\r\n"; //ouverture de la frontiére
$message.= $rn . "--" . $boundary . $rn;
//====================creation du message au format HTML====================
$message .= 'Content-Type: text/html; charset="utf-8"' . $rn;
$message .= 'Content-Transfer-Encoding:8bit' . $rn; // 8 bit pour les messages accentués
$message .= wordwrap($message, 70, "\r\n"); //limite le nbre de caractére du message à 70 par ligne
//$message .= $email_message;
$message .= $rn;
ect.............
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
//===========================Préparation Piéce jointe======================
if ($name_file != "") // si le fichier n'est pas nul
{
$file = $name_file;
$fp = fopen($file, "rb");
$attachment = fread($fp, filesize($file));
fclose($fp);
$attachment = chunk_split(base64_encode($attachment));
//================ ouverture de boundary pour la piece jointe==================
$message .= "--$boundary\r\n"; ////on ouvre boundary pour la piece jointe
//========================Codage et Envoi de la Piece Jointe====================
//-------------------------------------------
$message .= "Content-Type: $type2; name=\"$file\"\r\n";
$message .= "Content-Transfer-Encoding: base64\r\n";
$message .= "Content-Disposition: inline; filename=\"$file\"\r\n";
$message .= "\r\n";
$message .= $attachment . "\r\n";
$message .= "\r\n\r\n";
}
//--------------------Fin traitement de la Piéce Jointe ------------------------