Bonjour à tous
Ma question toute simple, la fonction mail() ne marche plus pour l'envoi de mail pour les adresses hotmail (.fr dans mon cas).
C'est un mail html avec pièce jointe. Il marche sans soucis pour les adresses gmail, yahoo, même les adresses mails jetables, et les mails ovh sous thunderbird... mais hotmail non
Bien sûr dans mon code Conf::$params['mail_contact'], $mail_client et $message_html contiennent les valeurs qu'il faut.
Merci de votre aide
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 $boundary = "-----=".md5(rand()); $boundary_alt = "-----=".md5(rand()); $header='From: "Objectif ChuteLibre" <' . Conf::$params['mail_contact'] .'>'."\n"; $header.='Reply-To: '. Conf::$params['mail_contact']."\n"; $header.= "MIME-Version: 1.0"."\n"; $header.= "Content-Type: multipart/mixed;"."\n"." boundary=\"$boundary\""."\n"; $content = "\n"."--".$boundary."\n"; $content.= "Content-Type: multipart/alternative;"."\n"." boundary=\"$boundary_alt\""."\n"; $content.= "\n"."--".$boundary_alt."\n"; $content.= "Content-Type: text/html; charset=\"utf-8\""."\n"; $content.= "Content-Transfer-Encoding: 8bit"."\n"; $content.= "\n".$message_html."\n"; $content.= "\n"."--".$boundary_alt."--"."\n"; $content.= "\n"."--".$boundary."\n"; // Ajout de la pièce jointe. if($existe_bon_cadeau){ $file_name = $num_reservation . ".pdf"; $data = chunk_split(base64_encode(file_get_contents($bon_cadeau))); $content .= "Content-Type: application/pdf; name=\"$file_name\" \n"; $content .= "Content-Transfer-Encoding: base64 \n"; $content .= "Content-Disposition: attachment; filename=\"$file_name\" \n"; $content .= "\n".$data."\n"; $content .= "\n--".$boundary."--\n"; } // Envoi de l'e-mail mail($mail_client, "Votre réservation sur le site Objectif ChuteLibre", $content, $header);
Partager