Envoi de mail en PHP

Bonjour,
J'essai 'envoye un mail voila le message que j'ai
<<Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() >> Je vous remerci deja. Pour vos aide...

2 réponses

  1. Bonjour,

    En gros ça dit qu'il n'arrive pas à ce connecter au serveur de messagerie (sur le port 25 smtp) qui se trouve sur votre ordinateur.

    Maintenant sans le code, c'est compliqué d'aller plus loin.
    Avez-vous vérifié dans le php.ini la partie [mail function] ?

    Cordialement
    0
    1. Salut Je vous remercie pour votre itervention.
      Voici la configuration de la parti mail function

      [mail function]
      ; For Win32 only.
      ; https://www.php.net/manual/en/mail.configuration.php#ini.smtp
      SMTP = smtp.gmail.com
      ; https://www.php.net/manual/en/mail.configuration.php#ini.smtp-port
      smtp_port = 587

      ; For Win32 only.
      ; https://www.php.net/manual/en/mail.configuration.php#ini.sendmail-from
      sendmail_from = mon_mail@gmail.com

      ; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
      ; https://www.php.net/manual/en/mail.configuration.php#ini.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 =
      0
  2. Il me semble qu'il est impossible d'envoyer un mail depuis localhost qui est ton serveur local et ne requiert pas de connexion internet.

    Pour utiliser/tester la fonction mail en PHP qui la nécessite, il faut logiquement que le site soit en ligne.
    0