Salut, j'ai rencontré un petit problème avec la fonction mail. Je suis hebergé chez ovh et je ne recois pas les mails que j'envoie, pourtant la fonction mail me revnoi bien TRUE.
J'envoi le mail à une adresse gmail
Je vous fournis mon code plus bas, je continue de chercher de mon côté :p merci
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
45
46
47
48 <?php // je change les adresses mails, c'est voulu ^^ $to = "my-client@gmail.com"; // adresse MAIL OVH liée à lhébergement. $from = "mail@mon-domaine.com"; ini_set("SMTP", "ssl0.ovh.net"); // *** Laisser tel quel $JOUR = date("Y-m-d"); $HEURE = date("H:i"); $Subject = "Test Mail - $JOUR $HEURE"; $mail_Data = ""; $mail_Data .= "<html> \n"; $mail_Data .= "<head> \n"; $mail_Data .= "<title> Subject </title> \n"; $mail_Data .= "</head> \n"; $mail_Data .= "<body> \n"; $mail_Data .= "Mail HTML simple : <b>$Subject </b> <br> \n"; $mail_Data .= "<br> \n"; $mail_Data .= "bla bla <font color=red> bla </font> bla <br> \n"; $mail_Data .= "Etc.<br> \n"; $mail_Data .= "</body> \n"; $mail_Data .= "</HTML> \n"; $headers = "MIME-Version: 1.0 \n"; $headers .= "Content-type: text/html; charset=iso-8859-1 \n"; $headers .= "From: $from \n"; $headers .= "Disposition-Notification-To: $from \n"; // Message de Priorité haute // ------------------------- $headers .= "X-Priority: 1 \n"; $headers .= "X-MSMail-Priority: High \n"; $CR_Mail = TRUE; $CR_Mail = @mail ($to, $Subject, $mail_Data, $header); if ($CR_Mail === FALSE){ echo " ### CR_Mail=$CR_Mail - Erreur envoi mail <br> \n"; } else { echo " *** CR_Mail=$CR_Mail - Mail envoyé<br> \n"; } ?>
Partager