Envoi de mail par site : OK mais tjrs en 2 ex

carolan -  
 carolan -
Bonjour,

Je veux que les visiteurs puissent adresser un mail au webmaster ; j'utilise PHP et la fonction MAIL. Tout marche bien, sauf que le message est systématiquement reçu en double exemplaire.
Une idée ?
Merci d'avance.

4 réponses

  1. Lord Zero Messages postés 487 Statut Membre 115
     
    ton code stp
    0
  2. lockoms Messages postés 15 Statut Membre 1
     
    Salut !

    Il nous faudrait ton code, steuplait :)
    0
  3. carolan
     
    Voila voila :

    <!-- Debut tableau CENTRAL -->
    <table align="center" bgcolor="#FFFFFF" border="0" width="760" cellspacing="0" cellpadding="0">
    <tr>
    <td width="6">&nbsp</td>
    <td height="30" width="748">&nbsp</td>
    <td width="6">&nbsp</td>
    </tr>
    <tr>
    <td width="6">&nbsp</td>
    <td align="center" width="748"><FONT color=#000000 face=Arial size=2>Pour nous contacter, utilisez ce formulaire :</b> </FONT></td>
    <td width="6">&nbsp</td>
    </tr>
    <tr><td colspan="3" width="760">&nbsp</td></tr>
    <tr>
    <td width="6">&nbsp</td>
    <td align="center" width="748">
    <!-- Debut tableau de SUPPORT -->
    <table border="0" width="560" cellspacing="0" cellpadding="0">
    <tr>
    <td width="560">
    <table align="center" border="0" width="534" bgcolor="#84BE95" cellspacing="0" cellpadding="0">
    <tr>
    <td bgcolor="#FFFFFF" width="15"><img src="images/anglehtgau.gif" height="24" width="15" alt="" border="0"></td>
    <td align="center" width="504"> </td>
    <td bgcolor="#FFFFFF" width="15"><img src="images/anglehtdte.gif" height="24" width="15" alt="" border="0"></td>
    </tr>
    <tr>
    <td width="15"> </td>
    <td width="504">
    <form action="cgi-bin/contact.php">
    <table align="center" border="0" width="504" bgcolor="#84BE95" cellspacing="0" cellpadding="0">
    <!-- indique le sujet du message -->
    <input type="hidden" name="subject" value="Contact par le site Tremolo">
    <tr>
    <td><FONT color=#000000 face=Arial size=2><b> Nom ou pseudo </b></FONT></td>
    <td><INPUT TYPE="text" NAME="Nom_Pseudo" SIZE=38></td>
    </tr>
    <tr>
    <td><FONT color=#000000 face=Arial size=2><b> Adresse e-mail </b></FONT></td>
    <td><INPUT TYPE="text" NAME="Mail" SIZE=38></td>
    </tr>

    <tr><td colspan="2"> </td></tr>
    <tr>
    <td colspan="2">
    <tr>
    <td colspan="2" align="center"><FONT color=#000000 face=Arial size=2><b> Message </b></FONT></td>
    </tr>
    <tr>
    <td colspan="2" align="center"><textarea rows="7" cols="42" name="Message"></textarea></td>
    </tr>
    <tr><td colspan="2"> </td></tr>
    </table>
    </td>
    <td width="15"> </td>
    </tr>
    <tr>
    <td bgcolor="#FFFFFF" width="15"><img src="images/anglebasgau.gif" height="24" width="15" alt="" border="0"></td>
    <td width="504"> </td>
    <td bgcolor="#FFFFFF" width="15"><img src="images/anglebasdte.gif" height="24" width="15" alt="" border="0"></td>
    </tr>
    </table>

    <table align="center" border="0" width="534" cellspacing="0" cellpadding="0">
    <tr><td> </td></tr>
    <tr>
    <td align="center"><input type="image" src="images/envoyez.gif" border=0 value="submit"></td>
    </tr>
    </table>
    </FORM>
    </td>
    </tr>
    </table>
    <!-- Fin tableau de SUPPORT -->
    </td>
    <td width="6">&nbsp</td>
    </tr>
    </table>
    <!-- Fin tableau CENTRAL -->

    Et le script :

    <?php
    // IMPORTANT VOUS DEVEZ CONFIGURER
    // L'ADRESSE EMAIL DE DESTINATION
    $dest="gv@tremolo.fr";
    // on recupere les infos
    $referer= getenv("HTTP_REFERER");
    // validation de forme
    //
    // ici inserer si besoin
    // les tests de validites
    // (syntaxe, champ obligatoire)
    // des champs de la forme
    // ...
    // mettre $ok a faux si c'est un echec
    $ok=1;
    if($ok){
    // envoi du resultat par email
    $sujet= "Page Contact de ".$referer;
    $body.="Page d'origine : $referer\n";
    $body.="\n*** Valeurs resultats ***\n";
    if(count($HTTP_POST_VARS)){
    while (list($key, $val) = each($HTTP_POST_VARS)){
    $body.="$key : $val\n";
    }
    }
    if(count($HTTP_GET_VARS)){
    while (list($key, $val) = each($HTTP_GET_VARS)){
    $body.="$key : $val\n";
    }
    }
    $body.="*************************\n";
    if(!mail($dest,$sujet,$body)){
    print "erreur envoi email";
    }
    // affiche le html qui suit si succes
    ?>
    <html>
    <BODY bgcolor="#AFACAC" TEXT=000000 LINK=000000 VLINK=000000 topmargin="6" leftmargin="0" rightmargin="0" bottommargin="6">
    <!-- Debut tableau CENTRAL -->
    <table align="center" bgcolor="#FFFFFF" border="0" width="760" cellspacing="0" cellpadding="0">
    <tr>
    <td width="6">&nbsp</td>
    <td height="50" width="748">&nbsp</td>
    <td width="6">&nbsp</td>
    </tr>
    <tr>
    <td width="6">&nbsp</td>
    <td align="center" width="748"><FONT color=#000000 face=Arial size=2>«« <a class="lien" href="http://delf.tremolo.fr/index.htm" target="_self">retour page accueil</a></FONT></td>
    <td width="6">&nbsp</td>
    </tr>
    <tr><td colspan="3" width="760">&nbsp</td></tr>
    <tr>
    <td width="6">&nbsp</td>
    <td align="center" width="748">
    <!-- Debut tableau de SUPPORT -->
    <table align="center" border="0" width="494" bgcolor="#84BE95" cellspacing="0" cellpadding="0">
    <tr>
    <td bgcolor="#FFFFFF" width="70"> </td>
    <td bgcolor="#FFFFFF" width="15"><img src="../images/anglehtgau.gif" height="24" width="15" alt="" border="0"></td>
    <td align="center" width="324"> </td>
    <td bgcolor="#FFFFFF" width="15"><img src="../images/anglehtdte.gif" height="24" width="15" alt="" border="0"></td>
    <td bgcolor="#FFFFFF" width="70"> </td>
    </tr>
    <tr>
    <td bgcolor="#FFFFFF" width="70"> </td>
    <td width="15"> </td>
    <td align="center" width="324"><FONT color=#000000 face=Arial size=2><b>Votre message a bien été envoyé, merci.<br><br></b></FONT></td>
    <td width="15"> </td>
    <td bgcolor="#FFFFFF" width="70"> </td>
    </tr>
    <tr>
    <td bgcolor="#FFFFFF" width="70"> </td>
    <td bgcolor="#FFFFFF" width="15"><img src="../images/anglebasgau.gif" height="24" width="15" alt="" border="0"></td>
    <td width="324"> </td>
    <td bgcolor="#FFFFFF" width="15"><img src="../images/anglebasdte.gif" height="24" width="15" alt="" border="0"></td>
    <td bgcolor="#FFFFFF" width="70"> </td>
    </tr>
    </table>
    <!-- Fin tableau de SUPPORT -->
    </td>
    <td width="6">&nbsp</td>
    </tr>
    <tr><td colspan="3" width="760">&nbsp</td></tr>
    <tr>
    <td width="6">&nbsp</td>
    <td align="center" width="748"><FONT color=#000000 face=Arial size=2>«« <a class="lien" href="http://delf.tremolo.fr/index.htm" target="_self">retour page accueil</a></FONT></td>
    <td width="6">&nbsp</td>
    </tr>
    <tr><td height="50" colspan="3" width="760">&nbsp</td></tr>
    </table>
    <!-- Fin tableau CENTRAL -->
    </BODY>
    </html>
    <?php
    }
    // affiche le html qui suit si erreur
    //
    else{
    ?>
    <html>
    <head><title>Erreur de formulaire</title></head>
    <body bgcolor="white">
    Attention : votre message n'a pas été envoyé
    </body>
    </html>
    <?php
    }
    ?>
    0
  4. carolan
     
    En fait, c'est uniquement avec le navigateur Seamonkey que j'ai cette anomalie ; je ne l'ai pas avec IE ni avec Firefox. Donc on va dire que ce n'est pas de mon ressort... Sauf bien sûr si quelqu'un connaissait le truc ?
    Sinon, merci à ceux qui ont commencé à chercher, et mes excuses pour cette quasi-fausse alerte.
    0