Bonjour a tous,
je me permet de poster ce thread car j'ai un souci avec la fonction mail() de php
et je n'ai trouvé aucune solution concrete pour resoudre mon souci
je suis sous wamp et je souhaiterai pour mon site qu'un mail soit envoyé (en local pour le coup histoire de tester le script) a la personne lors son inscription et qu'elle puisse cliquer sur le lien d'activation
le souci c'est qu'il me semble avoir tout bien configuré, d'ailleurs mon navigateur ne me retourne pas d'erreur, mais le mail ne s'envoi pas ou du moins je ne le recoit pas...
j'utilise fake sendmail il est simple a configurer, et je ne pense pas que le probleme vienne de la, je vous met mon sendmail.ini :
je met aussi le php.ini:
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72 ; configuration for fake sendmail ; if this file doesn't exist, sendmail.exe will look for the settings in ; the registry, under HKLM\Software\Sendmail [sendmail] ; you must change mail.mydomain.com to your smtp server, ; or to IIS's "pickup" directory. (generally C:\Inetpub\mailroot\Pickup) ; emails delivered via IIS's pickup directory cause sendmail to ; run quicker, but you won't get error messages back to the calling ; application. smtp_server=smtp.live.com ; smtp port (normally 25) smtp_port=25 ; SMTPS (SSL) support ; auto = use SSL for port 465, otherwise try to use TLS ; ssl = alway use SSL ; tls = always use TLS ; none = never try to use SSL smtp_ssl=auto ; the default domain for this server will be read from the registry ; this will be appended to email addresses when one isn't provided ; if you want to override the value in the registry, uncomment and modify default_domain=live.com ; log smtp errors to error.log (defaults to same directory as sendmail.exe) ; uncomment to enable logging error_logfile=error.log ; create debug log as debug.log (defaults to same directory as sendmail.exe) ; uncomment to enable debugging debug_logfile=debug.log ; if your smtp server requires authentication, modify the following two lines auth_username=********@hotmail.com auth_password=********* ; if your smtp server uses pop3 before smtp authentication, modify the ; following three lines. do not enable unless it is required. pop3_server=pop3.live.com pop3_username=*********@hotmail.com pop3_password=********* ; force the sender to always be the following email address ; this will only affect the "MAIL FROM" command, it won't modify ; the "From: " header of the message content force_sender= ; force the sender to always be the following email address ; this will only affect the "RCTP TO" command, it won't modify ; the "To: " header of the message content force_recipient= ; sendmail will use your hostname and your default_domain in the ehlo/helo ; smtp greeting. you can manually set the ehlo/helo name if required hostname=
voila voila ^^ je peut mettre aussi le script php d'envoi en lui meme :
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 [mail function] ; For Win32 only. ; http://php.net/smtp SMTP =smtp.live.com ; http://php.net/smtp-port smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = *********@hotmail.com ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path sendmail_path = "C:\Wamp\sendmail\sendmail.exe -t" ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of ; the 5th parameter to mail(), even in safe mode. ;mail.force_extra_parameters = ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename mail.add_x_header = On ; Log all mail() calls including the full path of the script, line #, to address and headers ;mail.log =
je crois que tout est la ^^ je ne sais pas du tout pourquoi je ne recoit pas ce mail, je n'ai aucune erreur a aucuns moments ...
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 <?php //envoyer un mail pour la validation du compte $to = $email; $sujet = 'Activation de votre compte'; $body = ' Bonjour et Bienvenue sur Tout les arts,<br/> veuillez cliquer sur ce lien pour acvtiver votre compte :<br/> <a href="http://localhost/********/activate.php?token ='.$token.'&email='.$to.'">Activation du compte</a>'; $entete = "MIME-Versions: 1.0\r\n"; $entete .= "Content-type: texte/html; charset=UTF-8\r\n"; $entete .= 'From: **********@hotmail.com' . "\r\n" . 'Reply-To: ************@hotmail.com' . "\r\n" . 'X-Mailer: PHP/' .phpversion(); mail($to,$sujet,$body,$entete); } else{ if(!empty($_POST) && strlen($_POST['pseudo'])<3){ $error_pseudo = 'Votre pseudo doit comporter au minimum 3 caracteres !'; } if(!empty($_POST) && !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $error_email = 'Votre Email n est pas valide !'; } } ?>
si vous avez une idée vous etes "welcome" parce que la je seche un peu
merci d'avance
je réedit un pti coup juste pour dire : j'ai inclus un 'echo' juste apres mail() histoire qu'il me dise si erreur il y a ... et rien ! le mail a bien été envoyé, ah oui aussi j'ai modifier les 2 php.ini au cas ou ^^ car en cherchant a resoudre le souci j'ai vu qu'il y en avait 2 sous wamp un dans php et un dans apache
Partager