Bonjour,
j'ai un soucis avec un script PHP qui est sensé envoyer un mail mais je ne reçois rien et, étant novice dans ce langage, je ne sais pas à quel endroit intervenir pour que cela fonctionne.
Voila la config :
Je suis en local sur mon poste : Vista
J'ai les librairies php à cet endroit : C:\Inetpub\php-4.3.11-Win32\
Et j'execute le script php en ligne de commande de cette manière :
C:\Inetpub\php-4.3.11-Win32\php.exe fichier_script.php
Le traitement de mon fichier ne pose pas de soucis mais c'est au moment de l'envoie ou je ne reçois rien au final.
Mon code :
Quand j'execute mon script, en ligne de commande dans l'invite Dos, il me met
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 $to= dan@domaine.fr $subject = "Retour de commande"; $message = ' <html> <head> <title> '.$subject.' </title> <style> BODY{font-family: sans-serif;font-size: 11} </style> </head> <body> <table> <tr> <td><b>Details </b> </td> </tr> <tr> <td style="border: 1 solid #000000" bgcolor="#FFFFCC"> hsdd sdhf sdh sdjg sdgf sdkfgsdkgfks </td> </tr> </table> </body> </html> '; $headers = "MIME-Version: 1.0 \n"; $headers .= "Content-Transfer-Encoding: 8bit \n"; $headers .= "Content-type: text/html; charset=utf-8 \n"; $headers .= "From: dan_bis@domaine.fr \n"; $headers .= "Disposition-Notification-To: dan@domaine.fr \n"; // accuse de reception //Envoi d'un email à l'administrateur $to = dan@domaine.fr; echo "send mail to" . $to; $verif_envoi_mail = TRUE; $verif_envoi_mail = @mail ($to,$subject,$message,$headers); if ($verif_envoi_mail === FALSE) echo " ### Verification Envoi du Mail=$verif_envoi_mail - Erreur envoi mail <br> \n"; else echo " *** Verification Envoi du Mail=$verif_envoi_mail - Mail envoyé avec succès de $to vers dan_bis@domaine.fr <br> avec comme sujet: $subject \n"; }
J'ai jeté un coup d'oeil dans mon php.ini et le SMTP est bien configuré avec le bon fornisseur.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3Send mail to dan@domaine.fr ### Verification Envoi du Mail= - Erreur envoi mail
Qu'est ce qui ferait que les mails ne partent pas? Quelqu'un a une idée?
Merci infiniment de vos lumières...je nage...enfin je coule là!
Partager