8768 sujets

Développement web côté serveur, CMS

Bonjour tous,

Je cherche une fonction mail php avec authentification pour tester mon smtp.
Je peux faire une recherche sur le net mais comme j'y connais rien, c'est au petit bonheur la chance, si j'en prend 1 qui fonctionne pas ou mal , les résultats seront faussé et je le verrais pas.


OHV me demande de mettre en ligne à la racine une fonction mail php avec authentification pour tester.
Si il remonte des erreur alors je dois ouvrir un ticket

car certains mails passent d'autres non avec l'erreur SMTP Error: Could not authenticate

Sur mon site WordPress, j'ai installé configure smtp.
le test que je viens de faire n'a pas fonctionné : il renvoi

SMTP -> get_lines(): $data was ""SMTP -> get_lines(): $str is "220 ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net ESMTP "SMTP -> get_lines(): $data is "220 ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net ESMTP "SMTP -> FROM SERVER:220 ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net ESMTP CLIENT -> SMTP: EHLO mondomaine.com SMTP -> get_lines(): $data was ""SMTP -> get_lines(): $str is "250-ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net "SMTP -> get_lines(): $data is "250-ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net "SMTP -> get_lines(): $data was "250-ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net "SMTP -> get_lines(): $str is "250-AUTH LOGIN PLAIN "SMTP -> get_lines(): $data is "250-ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net 250-AUTH LOGIN PLAIN "SMTP -> get_lines(): $data was "250-ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net 250-AUTH LOGIN PLAIN "SMTP -> get_lines(): $str is "250-AUTH=LOGIN PLAIN "SMTP -> get_lines(): $data is "250-ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN "SMTP -> get_lines(): $data was "250-ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN "SMTP -> get_lines(): $str is "250-PIPELINING "SMTP -> get_lines(): $data is "250-ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-PIPELINING "SMTP -> get_lines(): $data was "250-ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-PIPELINING "SMTP -> get_lines(): $str is "250-8BITMIME "SMTP -> get_lines(): $data is "250-ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-PIPELINING 250-8BITMIME "SMTP -> get_lines(): $data was "250-ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-PIPELINING 250-8BITMIME "SMTP -> get_lines(): $str is "250 SIZE 109000000 "SMTP -> get_lines(): $data is "250-ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-PIPELINING 250-8BITMIME 250 SIZE 109000000 "SMTP -> FROM SERVER:250-ns0.ovh.net ssl0.ovh.net. You connect to mail140.ha.ovh.net 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-PIPELINING 250-8BITMIME 250 SIZE 109000000 CLIENT -> SMTP: AUTH LOGIN SMTP -> get_lines(): $data was ""SMTP -> get_lines(): $str is "334 VXNlcm5hbWU6 "SMTP -> get_lines(): $data is "334 VXNlcm5hbWU6 "SMTP -> FROM SERVER:334 VXNlcm5hbWU6 CLIENT -> SMTP: dGVzdG1haWxAbW9udHBlbGxpZXItaG90ZWwtYWJlbGlhLmNvbQ== SMTP -> get_lines(): $data was ""SMTP -> get_lines(): $str is "334 UGFzc3dvcmQ6 "SMTP -> get_lines(): $data is "334 UGFzc3dvcmQ6 "SMTP -> FROM SERVER:334 UGFzc3dvcmQ6 CLIENT -> SMTP: bWFyZGkyc2VwdDE0 SMTP -> get_lines(): $data was ""SMTP -> get_lines(): $str is "555 sorry, too many emails (#5.7.1) "SMTP -> get_lines(): $data is "555 sorry, too many emails (#5.7.1) "SMTP -> FROM SERVER:555 sorry, too many emails (#5.7.1) SMTP -> ERROR: Password command failed: 555 sorry, too many emails (#5.7.1) CLIENT -> SMTP: QUIT SMTP -> get_lines(): $data was ""SMTP -> get_lines(): $str is ""SMTP -> get_lines(): $data is ""SMTP -> FROM SERVER:SMTP -> ERROR: QUIT command failed:

Qu'est ce que cela signifie ?
Merci de votre aide
Je viens de trouver ce script qui me semble correspondre à la demande d'OVH.
<?php
// TEST FONCTION MAIL() PHP
// CREEZ UNE FICHIER email.php

// *** A configurer
$to = "adresse@machin.truc";  
$from  = "postmaster@bidule.truc";  

// *** Laisser tel quel
$jour  = date("d-m-Y");
$heure = date("H:i");

$sujet = "Essai Mail - $jour $heure";

$contenu = "";
$contenu .= "<html> \n";
$contenu .= "<head> \n";
$contenu .= "<title> Subject </title> \n";
$contenu .= "</head> \n";
$contenu .= "<body> \n";
$contenu .= "Mail au format HTML simple avec la fonction PHP mail().<br> <b>$sujet </b> <br> \n";
$contenu .= "</body> \n";
$contenu .= "</HTML> \n";

$headers  = "MIME-Version: 1.0 \n";
$headers .= "Content-Transfer-Encoding: 8bit \n";
$headers .= "Content-type: text/html; charset=utf-8 \n";
$headers .= "From: $from  \n";
// $headers .= "Disposition-Notification-To: $from  \n"; // accuse de reception

$verif_envoi_mail = TRUE;

$verif_envoi_mail = @mail ($to, $sujet, $contenu, $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&eacute; avec succ&egrave;s de $to vers $from <br> avec comme sujet: $sujet \n"; 
?> 


Mais il contient pas de demande d'identification par SMPT, non ?
Je n'ai renté null part mes parametres SMTP. !!!
Smiley rolleyes

Que dois rajouter ?