Bonjour,
Bon je souhaite faire mon propre script d'envoi de mail et je seche depuis quelques heures avec ma pièce jointe. Lorsque j'envoie un mail je recois correctement la partie texte mais pas la partie attachment.
de vide zaezaeeza vide <azezea@hgj.hj>
vide :
Site web :
Tel :
Réponse via : mail
titre message
contenu message
Content-Type: image/gif; name="11.gif"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="11.gif"
R0lGODlhGQAZAIcAAAICKwICMQICNgICOQICPRISOwICQgICSAICTQICUQICVAICWgICXBISSwIC
YQICZQICaQICbQICcgICdQICegICfRISdwICgQIChgICiQICjQICkQIClAICmQICnRISgRISjQIC
oQICpAcHogICqQICrgQEqwsLqAsLrQICsgICtQICuQICvAgIsg8Psw8PvBISrxISuRkZthoavBwc
Source
J'ai essayé de nombreuses combinaisons de content-type mais rien à faire si quelqu'un peut jeter un oeil.
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
43
44 function EnvoiMail($mail, $sujet, $message, $fichier, $to, $reply) { //-=-=-=- MIME BOUNDARY $mime_boundary = '-----=' . md5( uniqid ( rand() ) ); $fname = $fichier['name']; $type = "image/gif"; //Ecriture du titre en utf-8 $sujet= mb_encode_mimeheader($sujet,"utf-8", "B", "\n"); // ENTETE $headers = "From: $mail\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "X-Priority: 1 (Higuest)\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "Importance: High\r\n"; $headers .= "Content-Type: multipart/mixed; boundary=$mime_boundary\r\n\n"; // PARTIE TEXTE $body = "--" ."$mime_boundary\n"; $body .= "Content-Type: text/plain; charset=utf-8\r\n"; $body .= "Content-Transfer-Encoding: quoted-printable\n\n"; $body .= $message ."\n"; // ENCODAGE DU FICHIER if (filesize("Upload/" .$fichier['name']) != 0) { $fichier=file_get_contents("Upload/" .$fichier['name']); $fichier=chunk_split(base64_encode($fichier)); } // AJOUT DE LA PIECE JOINTE $body .= "--" ."$mime_boundary\n\n"; $body .= "Content-Type: ".$type."; name=\"$fname\"\r\n"; $body .= "Content-Transfer-Encoding: base64\r\n"; $body .= "Content-Disposition: attachment; filename=\"$fname\"\r\n\n"; $body .= $fichier; // FIN DU MAIL $body .= "--" .$mime_boundary ."--"; //Envoi du mail if (mail($to, $sujet, $body, $headers)) return true; else return false; }
Cordialement.







Répondre avec citation
Partager