Bonjour,

Je voudrais envoyer un mail automatique en PHP avec une pièce jointe.
Je recois bien l'email mais sans la pièce jointe,pouvez vous me dire pourquoi?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
<?php 
     //----------------------------------------------- 
     //DECLARE LES VARIABLES 
     //----------------------------------------------- 
 
	 $destinataire='cyrille.pelatan@ieif.fr';
     $email_expediteur='cryc28@hotmail.com'; 
     $email_reply='cryc28@hotmail.com'; 
	 $sujet='Indice au 9 juin 2009';
     $message_html='Test de message pour voir si ca marche'."\n\n\n"; 
 
 
     //----------------------------------------------- 
     //HEADERS DU MAIL 
     //----------------------------------------------- 
 
     $headers = 'From: "IEIF" <'.$email_expediteur.'>'."\n"; 
     $headers .= 'Return-Path: <'.$email_reply.'>'."\n"; 
     $headers .= 'MIME-Version: 1.0'."\n"; 
     $headers .= 'Content-Type: multipart/mixed"'; 
 
     //----------------------------------------------- 
     //PIECE JOINTE 
     //----------------------------------------------- 
 
	 //$message  = 'This is a multi-part message in MIME format.'."\n\n"; 
     //$message .= 'Content-Type: image/gif; name="grap_ind.gif"'."\n"; 
     //$message .= 'Content-Transfer-Encoding: base64'."\n"; 
     //$message .= 'Content-Disposition:attachement; filename="grap_ind.gif"'."\n\n";
	 $message = $message_html;
     $message .= chunk_split(base64_encode(file_get_contents('grap_ind.gif')))."\n"; 
 
     if(mail($destinataire,$sujet,$message,$headers)) 
     { 
          echo 'Le mail a été envoyé'; 
     } 
     else 
     { 
          echo 'Le mail n\'a pu être envoyé'; 
     } 
?>
et je recois ca :

"Test de message pour voir si ca marche


R0lGODlh+gDWAPcAANHR0fnw8Prx8vr9+f709fz4+M7Ozv339//8//n5/v329vT/+f76/f399f/6
//nt7vz09Pb+/ff/+vv///rt7f7++v359vv7/v///P36/v75+vbv8Pz+//70/vf7+fjv8P7+9/v9
+/r/+fn/+/r8/vz++/7v8Pj//v77+Pz6+vz//f78+f/89/r8/Pny8/74/vn8/vn+9/f7/v37+fnz
9P7+/vHx8fT09Pn5+fb29vf39+7u7vr6+vX19fj4+PPz8/Ly8vDw8Pv7++rq6u3t7e/v7+vr6/z8
/Ozs7P39/ejo6P/+/unp6f3t7f3t7ufn5/3t7/vt7vnu7/7t7ebm5vzt7fzt7uPj4/ru7+Xl5d/f
3/7u7uLi4uDg4Pju7+Hh4dvb29zc3P7t7vfw8NfX1/nu7uTk5NjY2P3u7/3u7tTU1Pvu7/3y897e
3vfu7/3u8P7x8//9/f3x8fvw8f/t7frw8ffx8f3w8Nra2vrt7v7w8Pzx8vzu7/vt7/ju7tXV1ffv
7/74+f3x8t3d3f73+Pzv7/rv8Pvv8P7x8v7x8fvu7v7v7/zv8NPT0/7u7/76+v3w8fzy8tbW1vzw
8fnv7/7z8/ru7tnZ2dLS0vzx8f3v7/zy8/3v8Pzu7v7y8v/7+//6+vzw8P/8/Pvv7/zt7/7t7/jv
7/rv7//u7vvw8P78/P74+P3z8/3y8vfu7v729/vx8vvz8/75+fzu8Pvu8Pbv7/vy8/3v8frw8Prx
8f7y8/729v79/f77+/ry8vvy8v76+//z8/bw8P3w8v719f/v7//8/ffw8fbu7//5+fry8/rz8//3
9/rt7/zz8/7w8fft7vz9/v78/v79+/fx8v77+v/6+//w8P/x8fn19f/9///t7v3x8/n7+vr7+//9............."

Merci