Newsgroup: it.comp.www.php
Titolo: Form mail...

Ciao!!!
Questo script invia email con riassuntino finale a 3 indirizzi preimpostati.
Vorrei modificarlo in modo da far scegliere al visitatore a quale indirizzo
email inviare il messaggio.
Mi aiutate per favore????
GRAZIEEEEE !!!!!   ^____^
-----------------------------------
<?
/*
Envoi de mail par formulaire
Gorun RENAULT 
go...@users.sourceforge.net
Creation  30/01/2001             Dernière modif  01/05/2001
Vous pouvez adapter librement les fichiers gmail_header.php et
gmail_footer.php
*/
// Init Variables:
// config générale
$BKG_COLOR="#FFF9CE"; //couleur de fond du formulaire
// config de la liste des emails : tableau 3 dimensions
// lère colonne : identifiant destinataire : numéro de 1 à xxx
// nom : Nom du destinataire, qui apparaitra tel quel dans le formulaire
// email : adresse email du destinataire
$EMAIL = array (
 "1" => array (  "nom" => "Webmaster",
    "email" =>"
webm...@yourdomain.name
"),
  "2" => array (  "nom" => "first user",
   "email" => "
us...@yourdomain.name
"),
  "3" => array (  "nom" => "sec. user",
   "email" => "
us...@yourdomain.name
")
  );
// ne pas toucher aux lignes ci-dessous
$version="1.0";
$NB_EMAIL = count($EMAIL);
//déclaration fonctions
function confirm_envoi() {
 global $dest, $Mail, $Subject, $Text, $EMAIL, $BKG_IMG, $BKG_COLOR;
 $msg = nl2br(htmlentities(StripSlashes($Text)));
 $Subject = nl2br(htmlentities(StripSlashes($Subject)));
         include "gmail_header.php";
         print "
         <P><font size=\"4\">Le message suivant a bien &eacute;t&eacute;
envoy&eacute; :</font></P><br>
         <TABLE BORDER=2 ALIGN=\"CENTER\" WIDTH=\"80%\">
           <TR><TD>
            <TABLE BORDER=0 ALIGN=\"CENTER\" WIDTH=\"100%\"
CELLSPACING=\"0\" BGCOLOR=\"".$BKG_COLOR."\">
             <TR>
              <TD WIDTH=\"100\"><FONT SIZE=\"3\">Destinataire :</FONT></TD>
              <TD><B>" . $EMAIL[$dest]["nom"] . "</B></TD>
             </TR>
             <TR>
              <TD WIDTH=\"100\"><FONT SIZE=\"3\">Votre E-mail
:</FONT></TD><TD>$Mail</TD>
             </TR>
             <TR>
              <TD WIDTH=\"100\"><FONT SIZE=\"3\">Sujet
:</FONT></TD><TD>$Subject</TD>
             </TR>
             <TR>
              <TD COLSPAN=2 ALIGN=\"CENTER\"><HR WIDTH=\"90%\"></TD>
             </TR>
             <TR>
              <TD COLSPAN=\"2\" BGCOLOR=\"".$BKG_COLOR."\"><BR>$msg
               <TABLE WIDTH=\"100%\" CELLPADDING=\"15\" BORDER=\"0\">
                <TR>
                 <TD>
                 </TD>
                </TR>
               </TABLE>
              </TD>
             </TR>
            </TABLE>
           </TD></TR>
         </TABLE>\n
         <P><FORM><INPUT TYPE=\"BUTTON\" VALUE=\"Retour\"
onClick=\"history.go(-2)\"></FORM></P>\n";
         include "gmail_footer.php";
}
function affiche_formulaire($err_msg) {
 global $dest, $Mail, $Subject, $Text, $NB_EMAIL, $version, $EMAIL,
$BKG_IMG, $BKG_COLOR;  $msg = StripSlashes($Text);
 $Subject = StripSlashes($Subject);
 include "gmail_header.php";
        if ($err_msg) {
         echo "<br><b><i><font size=\"+1\" color=\"#FF0000\">" . $err_msg .
"</font></i></b>";
         }
        print "<FORM action=\"\" method=\"GET\">
        <TABLE BORDER=2 ALIGN=\"CENTER\">
         <TR><TD>
          <TABLE BORDER=0 ALIGN=\"CENTER\" CELLSPACING=\"0\"
BGCOLOR=\"".$BKG_COLOR."\">
           <TR>
            <TD WIDTH=\"110\"><FONT SIZE=\"3\">Ecrire &agrave; :</FONT></TD>
            <TD><B>";
        if ( (!$dest) || ($dest < 1) || ($dest > $NB_EMAIL) ) {
         print "<select name=\"dest\">";
         $i = 1;
         while ( $i <= $NB_EMAIL ) {
          print "<option value=\"" . $i . "\">" . $EMAIL[$i++]["nom"];
          }
         print "</select>";
         }
        else {
         print $EMAIL[$dest]["nom"];
         print "<input type=\"hidden\" name=\"dest\" value=\"$dest\">";
         }
        print "</B>
            </TD>
           </TR>
           <TR>
            <TD WIDTH=\"110\"><FONT SIZE=\"3\">Votre E-mail
:</FONT></TD><TD><INPUT name=\"Mail\" size=\"30\" value=\"$Mail\"></TD>
           </TR>
           <TR>
            <TD WIDTH=\"110\"><FONT SIZE=\"3\">Sujet :</FONT></TD><TD><INPUT
name=\"Subject\" size=\"30\" value=\"$Subject\"></TD>
           </TR>
           <TR>
            <TD COLSPAN=2 ALIGN=\"CENTER\"><HR WIDTH=\"90%\"></TD>
           </TR>
           <TR>
            <TD COLSPAN=\"2\" ALIGN=\"CENTER\" BGCOLOR=\"".$BKG_COLOR."\">
             <TEXTAREA cols=\"75\" name=\"Text\" rows=\"10\">$msg</TEXTAREA>
            </TD>
           </TR>
           <TR>
            <TD COLSPAN=\"2\"><CENTER><INPUT type=\"submit\"
value=\"Envoyer\"></CENTER>
            </TD>
           </TR>
          </TABLE>
         </TD></TR>
        </TABLE>\n</FORM>\n";
//Vous pouvez supprimer cette instruction si vous le souhaitez...
 print "<DIV ALIGN=\"CENTER\"><FONT SIZE=\"1\"><I>
 <A HREF=\"
http://gmail.sourceforge.net
\">Gmail-".$version."</A>
 </I></FONT></DIV>";
//
 include "gmail_footer.php";
}
if ($Mail || $Subject || $Text) {
 if (!$Mail) {
  affiche_formulaire("Vous devez indiquer votre adresse email");
  exit();
  }
 if (!$Subject) {
  affiche_formulaire("Vous devez indiquer un sujet");
  exit();
  }
 if (!$Text) {
  affiche_formulaire("Votre message est vide...");
  exit();
  }
 $headers  = "From: Anonyme sur $SERVER_NAME <$Mail>\n";
 $headers .= "X-Mailler: Gmail v$version auteur initial Gorun RENAULT.\n";
 $TO = $EMAIL[$dest]["email"];
 $message = "Message envoyé par l'intermédiaire du formulaire sur le site :
http://$SERVER_NAME\n\n";
 $message .= "Expéditeur : $Mail  -> $REMOTE_ADDR(" .
gethostbyaddr($REMOTE_ADDR) . ")\n\n";
 $message .= "Contenu du message
:\n_____________________________________________________________\n\n".
StripSlashes($Text) . "\n";
 $message .=
"_____________________________________________________________";
 if (mail($TO, StripSlashes($Subject), $message, $headers)) {
  confirm_envoi();
  }
 else {
  die ("Erreur interne lors de l'envoi du mail...");
  }
}
else {
  affiche_formulaire("");
 }
?>

 ha scritto nel messaggio
news:b7glaf$582$1...@phobos.ibnetwork.net...
