Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
download
/
CHESS_2022
:
email_attach.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<html> <body> <?php //---------------------------------- // Construction de l'ent�te //---------------------------------- $boundary = "-----=".md5(uniqid(rand())); $header = "MIME-Version: 1.0\r\n"; $header .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n"; $header .= "\r\n"; //-------------------------------------------------- // Construction du message proprement dit //-------------------------------------------------- $msg = "Je vous informe que ceci est un message au format MIME 1.0 multipart/mixed.\r\n"; //--------------------------------- // 1�re partie du message // Le texte //--------------------------------- $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 .= "Ceci est un mail avec 2 fichiers joints\r\n"; $msg .= "\r\n"; //--------------------------------- // 2nde partie du message // Le 1er fichier (inline) //--------------------------------- $file = "01.jpg"; $fp = fopen($file, "rb"); // le b c'est pour les windowsiens $attachment = fread($fp, filesize($file)); fclose($fp); $attachment = chunk_split(base64_encode($attachment)); $msg .= "--$boundary\r\n"; $msg .= "Content-Type: image/gif; name=\"$file\"\r\n"; $msg .= "Content-Transfer-Encoding: base64\r\n"; $msg .= "Content-Disposition: inline; filename=\"$file\"\r\n"; $msg .= "\r\n"; $msg .= $attachment . "\r\n"; $msg .= "\r\n\r\n"; //--------------------------------- // 3�me partie du message // Le 2�me fichier (attachment) //--------------------------------- $file = "02.pdf"; $fp = fopen($file, "rb"); $attachment = fread($fp, filesize($file)); fclose($fp); $attachment = chunk_split(base64_encode($attachment)); $msg .= "--$boundary\r\n"; $msg .= "Content-Type: image/gif; name=\"$file\"\r\n"; $msg .= "Content-Transfer-Encoding: base64\r\n"; $msg .= "Content-Disposition: attachment; filename=\"$file\"\r\n"; $msg .= "\r\n"; $msg .= $attachment . "\r\n"; $msg .= "\r\n\r\n"; $msg .= "--$boundary--\r\n"; $destinataire = "patrice.delpy@neuf.fr"; $expediteur = "moi@monsite.com"; $reponse = $expediteur; echo "Ce script envoie un mail avec 2 fichiers joints � $destinataire"; mail($destinataire, "Email avec 2 fichiers joints (dont 1 inline)", $msg, "Reply-to: $reponse\r\nFrom: $destinataire\r\n".$header); ?> </body> </html>