Se connecter avec
S'enregistrer | Connectez-vous

Formmail : problème !

Dernière réponse : dans Programmation

Slt tout le monde ! J'ai un gros problème génant, je n'arrive pas à faire fonctionner formmail et c'est plutot génant car je suis en train de créer un site pour quelqu'un ! Voilà la page ou se trouve formmail : http://62.147.181.251/jean-mi/mail/form.html

Voila à quoi j'ai droit une fois que j'essaye d'envoyer un message :

  1. Notice: Undefined variable: subject in e:\apache\www\jean-mi\mail\formmail.php on line 373
  2.  
  3. Notice: Undefined variable: msg in e:\apache\www\jean-mi\mail\formmail.php on line 374
  4.  
  5. Notice: Undefined variable: email in e:\apache\www\jean-mi\mail\formmail.php on line 378
  6.  
  7. Notice: Undefined variable: email1 in e:\apache\www\jean-mi\mail\formmail.php on line 382
  8.  
  9. Notice: Undefined variable: priority in e:\apache\www\jean-mi\mail\formmail.php on line 385
  10.  
  11. Notice: Undefined variable: NomFichier_name in e:\apache\www\jean-mi\mail\formmail.php on line 386
  12.  
  13. Notice: Undefined property: organization in e:\apache\www\jean-mi\mail\formmail.php on line 312
  14.  
  15. Notice: Undefined property: priority in e:\apache\www\jean-mi\mail\formmail.php on line 315
  16.  
  17. 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() in e:\apache\www\jean-mi\mail\formmail.php on line 176
  18.  
  19. Notice: Undefined variable: NomFichier_name in e:\apache\www\jean-mi\mail\formmail.php on line 391
  20. Entrez ici la réponse quand une personne envoie le formulaire


Quelqu'un pourrait m'aider ? Je sais plus bidouiller que programmer si vous voyez ce que je veux dire :??:  :whistle: 

Autres pages sur : formmail probleme

Lassé par la pub ? Créez un compte

Citation :
Il serait possible de voir le code du fichier "formulaire.php" afin que nous puissions t'aider plus ? ( n'oublie pas > [*CODE*] [*/CODE*] )


Heu, j'ai pas de fichier "formulaire.php" :D  :sweat: 

Shino-Genin a dit :
Si l'envoi ne marche pas en local, tu as essayé de le mettre chez ton hébergeur de site ?

Sinon, balance le code de ta page et de formail.


Donc voila la page de départ ou il y a le formulaire :

  1. <title>Estimation</title>
  2. <body bgcolor="#E60030">
  3.  
  4. <form vname="FormName" action="formmail.php" method="post" enctype="multipart/form-data" name="form">
  5. <div align="center">
  6. <center>
  7. <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="60%" height="159">
  8. <tr>
  9. <td width="110" bgcolor="#FFFFFF" bordercolor="#FFCC00" height="96" align="center">
  10. <img border="0" src="../images/logo_orpi_2.jpg" width="110" height="96"></td>
  11. <td width="430" bgcolor="#FFFFFF" bordercolor="#FFCC00" height="96" colspan="3" align="center">
  12. <p align="center" dir="ltr">
  13. <img border="0" src="../images/index.1.jpg" width="80%" height="95%"></td>
  14. </tr>
  15. <tr>
  16. <td width="540" bgcolor="#FFFFFF" bordercolor="#FFCC00" height="6" colspan="4" align="center"> </td>
  17. </tr>
  18. <tr>
  19. <td width="110" bgcolor="#E90232" bordercolor="#FFFFFF" height="19" align="center" style="border-style: none; border-width: medium">
  20. <b><font face="Microsoft Sans Serif" size="2" color="#FFFFFF">
  21. <a href="../index.htm" style="text-decoration: none"><font color="#FFFFFF">Acceuil</font></a></font></b></td>
  22. <td width="160" bgcolor="#E90232" bordercolor="#FFFFFF" height="19" align="center" style="border-style: none; border-width: medium">
  23. <b><a style="text-decoration: none" href="../ventes-achats.htm"><font face="Microsoft Sans Serif" size="2" color="#FFFFFF">Ventes /
  24. Achats</font></a></b></td>
  25. <td width="135" bgcolor="#E90232" bordercolor="#FFFFFF" height="19" align="center" style="border-style: none; border-width: medium">
  26. <b>
  27. <font face="Microsoft Sans Serif" size="2">Contacts</font></b></td>
  28. <td width="135" bgcolor="#E90232" bordercolor="#FFFFFF" height="19" align="center" style="border-style: none; border-width: medium">
  29. <b>
  30. <a href="<a href="http://62.147.181.251/jean-mi/subscribe.php" target="_blank">http://62.147.181.251/jean-mi/subscribe.php</a>" style="text-decoration: none"><font face="Microsoft Sans Serif" size="2" color="#FFFFFF">Newslestter</font></a></b></td>
  31. </tr>
  32. <tr>
  33. <td bgcolor="#808080" bordercolor="#FFCC00" height="15" colspan="4" align="center" width="540">
  34. <p align="center">
  35. <font face="Times New Roman" color="#FFFFFF" style="font-size: 9pt">
  36. <marquee scrollamount="4">LAWRENCE IMMOBILIER ---- Offres du moment : Maison 120 m² à Pau 850000 € ; Appartement T3 80 m² 25790 € ---- LAWRENCE IMMOBILIER</marquee></font></td>
  37. </tr>
  38. <tr>
  39. <td width="540" bgcolor="#FFFFFF" bordercolor="#FFCC00" height="19" colspan="4" align="center">
  40. <p align="left">
  41. <font face="Microsoft Sans Serif" style="font-size: 9pt"><u>Vous êtes ici</u>
  42. : Contacts</font></td>
  43. </tr>
  44. <tr>
  45. <td width="540" bgcolor="#FFFFFF" bordercolor="#FFCC00" height="19" colspan="4" align="center">
  46. <p align="left"><font face="Microsoft Sans Serif" size="2">Veuillez
  47. indiquer :</font></p>
  48. <p align="justify"><font face="Microsoft Sans Serif" size="2">- Votre nom,
  49. prénom, adresse, mail et un numéro de téléphone pour que je puisse vous
  50. joindre. Vous pouvez insérer un fichier joint si besoin.</font></td>
  51. </tr>
  52. </table>
  53. </center>
  54. </div>
  55. <div align="center">
  56. <center>
  57. <table border="0" cellpadding="5" cellspacing="0" width="60%" style="border-collapse: collapse" bordercolor="#111111">
  58. <tr>
  59. <td width="68">
  60. <font face="Microsoft Sans Serif" size="2" color="#FFFFFF">Expéditeur:</font></td>
  61. <td width="501"><font face="Microsoft Sans Serif" color="#FFFFFF"><input type="text" name="email" size="35"></font></td>
  62. </tr>
  63. <tr>
  64. <td width="68">
  65. <font face="Microsoft Sans Serif" size="2" color="#FFFFFF">Sujet</font></td>
  66. <td width="501"><font face="Microsoft Sans Serif" color="#FFFFFF"><input type="text" name="subject" size="35"></font></td>
  67. </tr>
  68. <tr>
  69. <td width="68">
  70. <font face="Microsoft Sans Serif" size="2" color="#FFFFFF">Message</font></td>
  71. <td width="501"><font face="Microsoft Sans Serif" color="#FFFFFF">
  72. <textarea rows="12" name="msg" cols="54">Nom :
  73. Prénom :
  74. Adresse domicile :
  75. Votre email :
  76. Votre numero de téléphone :
  77. Entrez votre message</textarea></font></td>
  78. </tr>
  79. <tr>
  80. <td width="68">
  81. <font face="Microsoft Sans Serif" size="2" color="#FFFFFF">Fichier joint:</font></td>
  82. <td width="501"><font face="Microsoft Sans Serif" color="#FFFFFF"><input type="hidden" name="MAX_FILE_SIZE" value="100000">
  83. </font><font face="Microsoft Sans Serif" color="#FFFFFF"><input name="NomFichier" type="file" size="16"></font></td>
  84. </tr>
  85. <tr>
  86. <td width="68">
  87. <font face="Microsoft Sans Serif" size="2" color="#FFFFFF">Priorité:</font></td>
  88. <td width="501">
  89. <div align="left">
  90. <font face="Microsoft Sans Serif"><font color="#FFFFFF">
  91. <select name="priority" size="1">
  92. <option value="1">Urgent
  93. <option value="2">Haute
  94. <option value="3">Moyenne
  95. <option value="4">Basse
  96. <option value="5">Très basse
  97. </select></font><font size="2" color="#FFFFFF"> </font>
  98. <font color="#FFFFFF"> <input type="submit" value="Envoyer"></font></font></div>
  99. </td>
  100. </tr>
  101. </table>
  102. </center>
  103. </div>
  104. </form>

Citation :
faut que tu changes le server smtp dans php.ini

et puis, éviter d'utiliser des variables non assignées :o 


Tu crois que c'est nécessaire avec formail :??:  :heink: 

Parceque formail est un truc tout simple...

Oulala ! Mon serveur à un gros bord.. ! Ya plus aucun forum ou truc en php qui fonctionne !!! C'est peut-être parceque j'ai mis trop de bases de données ? Y'en à déjà 10... Vous croyez que ca peut venir de la ?

formmail.php

  1. <?
  2. /* PARAMETRAGE DU SCRIPT */
  3. /* ENTREZ VOTRE ADRESSE EMAIL ENTRE LES GUILLEMETS*/
  4.  
  5. $dest="seb.calero@free.fr";
  6.  
  7. $reponse=StripSlashes("Entrez ici la réponse quand une personne envoie le formulaire");
  8.  
  9. /* FIN DU PARAMETRAGE */
  10.  
  11.  
  12. /*
  13.  
  14. Form Mail +
  15. Loïc Bresler
  16. Script permettant d'envoyer un mail grâce à un formulaire sur un site. Ce qu'il fait de plus que les autres
  17. c'est qu'il gère la priorité du message, les copies et permet d'envoyer un fichier joint si l'hébergeur le permet
  18. (en gros presque tous sauf Online et Nexen)
  19. Le script utilise une version de la classe Mail() développée par Leo West (lwest.free.fr) et modifiée par mes soins.
  20.  
  21.  
  22.  
  23. DESCRIPTION
  24.  
  25. this class encapsulates the PHP mail() function.
  26. implements CC, Bcc, Priority headers
  27. */
  28.  
  29.  
  30.  
  31. class Mail
  32. {
  33.  
  34. var $sendto= array();
  35. var $from, $msubject;
  36. var $acc= array();
  37. var $abcc= array();
  38. var $aattach= array();
  39. var $priorities= array( '1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)' );
  40.  
  41.  
  42. // Mail contructor
  43.  
  44. function Mail()
  45. {
  46. $this->autoCheck( true );
  47. }
  48.  
  49.  
  50. /* autoCheck( $boolean )
  51. * activate or desactivate the email addresses validator
  52. * ex: autoCheck( true ) turn the validator on
  53. * by default autoCheck feature is on
  54. */
  55.  
  56. function autoCheck( $bool )
  57. {
  58. if( $bool )
  59. $this->checkAddress = true;
  60. else
  61. $this->checkAddress = false;
  62. }
  63.  
  64.  
  65. /* Subject( $subject )
  66. * define the subject line of the email
  67. * $subject: any valid mono-line string
  68. */
  69.  
  70. function Subject( $subject )
  71. {
  72. $this->msubject = strtr( $subject, "\r\n" , " " );
  73. }
  74.  
  75.  
  76. /* From( $from )
  77. * set the sender of the mail
  78. * $from should be an email address
  79. */
  80.  
  81. function From( $from )
  82. {
  83.  
  84. if( ! is_string($from) ) {
  85. echo "Class Mail: error, From is not a string";
  86. exit;
  87. }
  88. $this->from= $from;
  89. }
  90.  
  91.  
  92. /* To( $to )
  93. * set the To ( recipient )
  94. * $to : email address, accept both a single address or an array of addresses
  95. */
  96.  
  97. function To( $to )
  98. {
  99.  
  100. // TODO : test validité sur to
  101. if( is_array( $to ) )
  102. $this->sendto= $to;
  103. else
  104. $this->sendto[] = $to;
  105.  
  106. if( $this->checkAddress == true )
  107. $this->CheckAdresses( $this->sendto );
  108.  
  109. }
  110.  
  111.  
  112. /* Cc()
  113. * set the CC headers ( carbon copy )
  114. * $cc : email address(es), accept both array and string
  115. */
  116.  
  117. function Cc( $cc )
  118. {
  119. if( is_array($cc) )
  120. $this->acc= $cc;
  121. else
  122. $this->acc[]= $cc;
  123.  
  124. if( $this->checkAddress == true )
  125. $this->CheckAdresses( $this->acc );
  126.  
  127. }
  128.  
  129.  
  130.  
  131. /* Bcc()
  132. * set the Bcc headers ( blank carbon copy ).
  133. * $bcc : email address(es), accept both array and string
  134. */
  135.  
  136. function Bcc( $bcc )
  137. {
  138. if( is_array($bcc) ) {
  139. $this->abcc = $bcc;
  140. } else {
  141. $this->abcc[]= $bcc;
  142. }
  143.  
  144. if( $this->checkAddress == true )
  145. $this->CheckAdresses( $this->abcc );
  146. }
  147.  
  148.  
  149. /* Body()
  150. * set the body of the mail ( message )
  151. */
  152.  
  153. function Body( $body )
  154. {
  155. $this->body= $body;
  156. }
  157.  
  158.  
  159. /* Send()
  160. * fornat and send the mail
  161. */
  162.  
  163. function Send()
  164. {
  165. // build the headers
  166. $this->_build_headers();
  167.  
  168. // include attached files
  169. if( sizeof( $this->aattach > 0 ) ) {
  170. $this->_build_attachement();
  171. $body = $this->fullBody . $this->attachment;
  172. }
  173.  
  174. // envoie du mail aux destinataires principal
  175. for( $i=0; $i< sizeof($this->sendto); $i++ ) {
  176. $res = mail($this->sendto[$i], $this->msubject,$body, $this->headers);
  177. // TODO : trmt res
  178. }
  179.  
  180. }
  181.  
  182.  
  183. /* Organization( $org )
  184. * set the Organisation header
  185. */
  186.  
  187. function Organization( $org )
  188. {
  189. if( trim( $org != "" ) )
  190. $this->organization= $org;
  191. }
  192.  
  193.  
  194. /* Priority( $priority )
  195. * set the mail priority
  196. * $priority : integer taken between 1 (highest) and 5 ( lowest )
  197. * ex: $m->Priority(1) ; => Highest
  198. */
  199.  
  200. function Priority( $priority )
  201. {
  202.  
  203. if( ! intval( $priority ) )
  204. return false;
  205.  
  206. if( ! isset( $this->priorities[$priority-1]) )
  207. return false;
  208.  
  209. $this->priority= $this->priorities[$priority-1];
  210.  
  211. return true;
  212.  
  213. }
  214.  
  215.  
  216. /* Attach( $filename, $filetype )
  217. * attach a file to the mail
  218. * $filename : path of the file to attach
  219. * $filetype : MIME-type of the file. default to 'application/x-unknown-content-type'
  220. * $disposition : instruct the Mailclient to display the file if possible ("inline") or always as a link ("attachment")
  221. * possible values are "inline", "attachment"
  222. */
  223.  
  224. function Attach( $filename, $filetype='application/x-unknown-content-type', $disposition = "inline" )
  225. {
  226. // TODO : si filetype="", alors chercher dans un tablo de MT connus / extension du fichier
  227. $this->aattach[] = $filename;
  228. $this->actype[] = $filetype;
  229. $this->adispo[] = $disposition;
  230. }
  231.  
  232.  
  233. /* Get()
  234. * return the whole e-mail , headers + message
  235. * can be used for displaying the message in plain text or logging it
  236. */
  237.  
  238. function Get()
  239. {
  240. $this->_build_headers();
  241. if( sizeof( $this->aattach > 0 ) ) {
  242. $this->_build_attachement();
  243. $this->body= $this->body . $this->attachment;
  244. }
  245. $mail = $this->headers;
  246. $mail .= "\n$this->body";
  247. return $mail;
  248. }
  249.  
  250.  
  251. /* ValidEmail( $email )
  252. * return true if email adress is ok - regex from Manuel Lemos (mlemos@acm.org)
  253. * $address : email address to check
  254. */
  255.  
  256. function ValidEmail($address)
  257. {
  258. if( ereg( ".*<(.+)>", $address, $regs ) ) {
  259. $address = $regs[1];
  260. }
  261. if(ereg( "^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)\$",$address) )
  262. return true;
  263. else
  264. return false;
  265. }
  266.  
  267.  
  268. /* CheckAdresses()
  269. * check validity of email addresses
  270. * if unvalid, output an error message and exit, this may be customized
  271. * $aad : array of emails addresses
  272. */
  273.  
  274. function CheckAdresses( $aad )
  275. {
  276. for($i=0;$i< sizeof( $aad); $i++ ) {
  277. if( ! $this->ValidEmail( $aad[$i]) ) {
  278. echo "Class Mail, method Mail : invalid address $aad[$i]";
  279. exit;
  280. }
  281. }
  282. }
  283.  
  284.  
  285. /********************** PRIVATE METHODS BELOW **********************************/
  286.  
  287.  
  288.  
  289. /* _build_headers()
  290. * [INTERNAL] build the mail headers
  291. */
  292.  
  293. function _build_headers()
  294. {
  295.  
  296. // creation du header mail
  297.  
  298. $this->headers= "From: $this->from\n";
  299.  
  300. $this->to= implode( ", ", $this->sendto );
  301.  
  302. if( count($this->acc) > 0 ) {
  303. $this->cc= implode( ", ", $this->acc );
  304. $this->headers .= "CC: $this->cc\n";
  305. }
  306.  
  307. if( count($this->abcc) > 0 ) {
  308. $this->bcc= implode( ", ", $this->abcc );
  309. $this->headers .= "BCC: $this->bcc\n";
  310. }
  311.  
  312. if( $this->organization != "" )
  313. $this->headers .= "Organization: $this->organization\n";
  314.  
  315. if( $this->priority != "" )
  316. $this->headers .= "X-Priority: $this->priority\n";
  317.  
  318. }
  319.  
  320.  
  321.  
  322. /*
  323. * _build_attachement()
  324. * internal use only - check and encode attach file(s)
  325. */
  326. function _build_attachement()
  327. {
  328. $this->boundary= "------------" . md5( uniqid("myboundary") ); // TODO : variable bound
  329.  
  330. $this->headers .= "MIME-Version: 1.0\nContent-Type: multipart/mixed;\n boundary=\"$this->boundary\"\n\n";
  331. $this->fullBody = "This is a multi-part message in MIME format.\n--$this->boundary\nContent-Type: text/plain; charset=us-ascii\nContent-Transfer-Encoding: 7bit\n\n" . $this->body ."\n";
  332. $sep= chr(13) . chr(10);
  333.  
  334. $ata= array();
  335. $k=0;
  336.  
  337. // for each attached file, do...
  338. for( $i=0; $i < sizeof( $this->aattach); $i++ ) {
  339.  
  340. $filename = $this->aattach[$i];
  341. $basename = basename($filename);
  342. $ctype = $this->actype[$i]; // content-type
  343. $disposition = $this->adispo[$i];
  344.  
  345. if( ! file_exists( $filename) ) {
  346. echo "Class Mail, method attach : file $filename can't be found"; exit;
  347. }
  348. $subhdr= "--$this->boundary\nContent-type: $ctype;\n name=\"$basename\"\nContent-Transfer-Encoding: base64\nContent-Disposition: $disposition;\n filename=\"$basename\"\n";
  349. $ata[$k++] = $subhdr;
  350. // non encoded line length
  351. $linesz= filesize( $filename)+1;
  352. $fp= fopen( $filename, 'r' );
  353. $data= base64_encode(fread( $fp, $linesz));
  354. fclose($fp);
  355. $ata[$k++] = chunk_split( $data );
  356.  
  357. /*
  358. // OLD version - used in php < 3.0.6 - replaced by chunk_split()
  359. $deb=0; $len=76; $data_len= strlen($data);
  360. do {
  361. $ata[$k++]= substr($data,$deb,$len);
  362. $deb += $len;
  363. } while($deb < $data_len );
  364.  
  365. */
  366. }
  367. $this->attachment= implode($sep, $ata);
  368. }
  369.  
  370.  
  371. } // class Mail
  372.  
  373. $subject=StripSlashes($subject);
  374. $msg=StripSlashes($msg);
  375. $msg="Message depuis votre site web:
  376. $msg";
  377. $m= new Mail; // create the mail
  378. $m->From( "$email" );
  379. $m->To( "$dest");
  380. $m->Subject( "$subject" );
  381. $m->Body( $msg); // set the body
  382. if ($email1!="") {
  383. $m->Cc( "$email1");
  384. }
  385. $m->Priority($priority) ;
  386. if ("$NomFichier_name"!="") {
  387. copy("$NomFichier","../upload/$NomFichier_name");
  388. $m->Attach( "../upload/$NomFichier_name", "application/octet-stream" );
  389. }
  390. $m->Send();
  391. if ("$NomFichier_name"!="") {
  392. Unlink("../upload/$NomFichier_name"); }
  393. echo "$reponse";
  394.  
  395. ?>


Je ne vois rien aux lignes ou il y a soit-disant un problème... :whistle:  Bon après c'est vrai j'y connait rien au PHP :D  :p  :sweat: 
Expert Programmation

Et j'espère que quand tu dis bases, tu parles en fait des tables d'une seule et même base ? Il ne sert à rien de multiplier les bases...

Il te dit simplement que tes variables ($...) n'existent pas ! En gros, sauf erreur de ma part, il te manque la transmission des variables de ton formulaire vers lon script formmail.php

Par ex, on ne voit nulle part : "$msg = $_POST['message'];" signifiant que la variable $msg prend la valeur de ce qui a été mis dans le formulaire au niveau de la zone "message".

Et ça ne te dirait pas d'arêter la programmation à papy et de passer au xhtml/css, parce que là, ton code est imbuvable à lire... :/ 

Dans le sens de marsien, tu as deux choix :

* soit comme elle le dit si bien "$msg = $_POST['message'];"
* soit tu met le paramètre register_globalà la valeur On (si je me rapelle bien), cela aura pour effet de faire ceci : "$message = $_POST['message'];" Sans que tu n'est rien à faire. Mais bon pour programmer c'est pas le top je trouve [:gordon shumway]

Bon, je vais voir tout ca ! Sinon, vous ne connaissez pas un formulaire tout pret avec demande du nom, prénom, adresse perso et mail + zone de message et qui envoi directe à une adresse mail sans utiliser "mailto" qui ouvre la messagerie ? Et dernier truc, j'ai lu que il n'y avait que certains serveurs qui supportaient l'envoi d'email à partir d'un page, vous croyez que mon serveur justement ne supporte pas cette fonction ?

Citation :
Il te faut regarder la configuration dans ton php.ini (ou avec phpinfo() ).

Pour plus d'informations : http://fr.php.net/manual/fr/ref.mail.php


Merci Orni ca marche ! Mais j'ai abandonné formmail pour PHPML : génial ! Mais la un seul et unique problème : quand j'essaye d'envoyer un message à un inscrit dans la liste à partir de l'interface :

  1. Parse error: parse error in e:\apache\www\jean-mi\php_mail\Mail_fonctions\Fonction_mail_bcc.php on line 49


D'autre fois c'est aussi :
  1. Parse error: parse error in e:\apache\www\jean-mi\php_mail\Mail_fonctions\Fonction_mail_bcc.php on line 46


Voilà la page en question qui merdouille :

  1. <?php
  2. /*
  3. ***************************************************************************************************************************
  4. * *
  5. * Nom de la source : *
  6. * PHP ML *
  7. * Nom du fichier par défaut : *
  8. * Fonction_mail_bcc.php *
  9. * Auteur : *
  10. * Nuel Guillaume alias Immortal-PC *
  11. * Site Web : *
  12. * <a href="http://www.immortalpc.free.fr/" target="_blank">http://www.immortalpc.free.fr/</a> *
  13. * *
  14. ***************************************************************************************************************************
  15. */
  16. if(!defined('PROTECTION')){include('./Error404.php');}// Protection
  17.  
  18. if($_POST['to'] == 'Tout les membres'){// Si $_POST['to'] = 'Tout les membres' alors on envoie un E-Mail a tout les membres
  19. // On optient toutes les adresses email
  20. $res = requette_MySQL('SELECT `email` FROM `'.$prefix_table.'_emails`;');
  21. $email = '';
  22. while($db = mysql_fetch_array($res)){
  23. $email .= $db['email'].',';
  24. }
  25.  
  26. // On vérifie si le dernier caratère et une virgule
  27. if($email{strlen($email)-1} === ','){
  28. $email{strlen($email)-1} = '';
  29. }
  30.  
  31. $name_to = 'Tout les Membres';
  32. $mail_to = $_POST['from'];
  33. $entete .= 'Bcc: '.$email."\r\n";
  34.  
  35. }elseif(substr_count($_POST['to'], ',')){
  36. $name_to = str_replace(',', ', ', $_POST['to']);
  37. $mail_to = $_POST['from'];
  38. $entete .= 'Bcc: '.$_POST['to']."\r\n";
  39.  
  40. }else{// Si non c'est que $_POST['to'] n'est pas egale à 'Tout les membres' alors envoie du message a une personne bien précise
  41. $name_to = $_POST['to'];
  42. $mail_to = $_POST['to'];
  43. }
  44.  
  45.  
  46. if(mail($mail_to, $_POST['objet'], $texte_html, $entete)){// E-Mail
  47. if($name_to == 'Tout les membres'){$name_to = $mail_to;}
  48. redirect($_SERVER['REQUEST_URI'].'&mail=send&to='.$name_to);// Redirection pour éviter de renvoyer l'E-Mail une 2 ème fois
  49. }else{
  50. echo '<div class="center Texte_Rouge"><img src="./Images/Del.gif" alt="Erreur" /> L\' E-Mail avec le sujet \'<span class="Gras">',$_POST['objet'],'</span>\' n\' a été envoyé à \'<span class="Gras">',$name_to,'</span>\'.</div>',"\r\n";
  51. }
  52. ?>


J'ai configuré php.ini avec smpt en port 25, l'adresse mail de départ que je veux et pop.free.fr

merci d'avance :jap: 

Je vois pas trop d'erreurs, mais plusieurs remarques :

- Tu dois initialiser tes variables en dehors des boucles et autres conditions (if, elseif et else). C'est pas obligatoire mais conseillé !
- Tu ne vérifie à aucun moment si tes variables sont addslashées (et autres problèmes qui pourraient intervenir).

Sinon teste bien toutes tes variables pour voir si elles sont correctes (vive la fonction echo).
Lassé par la pub ? Créez un compte