j'ai une petite application web qui est censée à un moment donné m'envoyer un mail (sur mon adresse gmail).
J'ai créé un compte gmail exprès pour cette appli.
Seulement voilà, il me semble avoir configuré le php.ini de sorte qu'il utilise le sendmail.exe de XAMPP.
Il me semble aussi avoir correctement configuré un compte gmail dans le sendmail.ini .
Le retour de mon script m'affiche que le mail a bien été envoyé, seulement je ne reçoit désespérément rien dans ma boite gmail :'(
voici la partie me concernant du php.ini :
voici le sendmail.ini[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP = smtp.gmail.com
; http://php.net/smtp-port
;smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"\BTS\xampp\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 = Off
; Log all mail() calls including the full path of the script, line #, to address and headers
mail.log = "\BTS\xampp\apache\logs\php_mail.log"
et enfin voici le code php gérant cet envoi :# Example for a user configuration file
# Set default values for all following accounts.
defaults
logfile "\BTS\xampp\sendmail\sendmail.log"
# Mercury
account Mercury
host localhost
from postmaster@localhost
auth off
# A freemail service example
account Hotmail
tls on
tls_certcheck off
host smtp.live.com
from [exampleuser]@hotmail.com
auth on
user [exampleuser]@hotmail.com
password [examplepassword]
account gmail
tls on
tls_certcheck on
host smtp.gmail.com
from [email protected]
auth on
user [email protected]
password monpass
# Set a default account
account default : gmail
echo "<br />L'adresse destinataire est $mail.";
//ini_set('SMTP', 'smtp.gmail.com');
$headers ='From: "Rezo"<[email protected]>'."\n";
$headers .='Reply-To: [email protected]'."\n";
$headers .='Content-Type: text/plain; charset="UTF-8"'."\n";
$headers .='Content-Transfer-Encoding: 8bit';
if(mail($mail, 'Un message de mon application', 'Bonjour, je suis une appli', $headers))
{
echo 'Le message a bien été envoyé';
}
else
{
echo 'Le message n\'a pu être envoyé';
}
J'ai lu quelques tutos sur le net, trouvé plusieurs versions du php.ini... mais rien de ce que j'ai lu n'a fonctionné, du moins je n'ai su en faire fonctionner aucun.Quelqu'un aurait une idée ?