Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente bannato
    Registrato dal
    May 2008
    Messaggi
    267

    Modulo invio email (SI/NO)

    Ciao,
    ho un sito che risiede su aruba.
    Ho creato un modulo contatti il quale invia l'email tramite il file contatti.php

    Ecco il file contatti.php
    codice:
    <?php
    // Website Contact Form Generator 
    // http://www.tele-pro.co.uk/scripts/contact_form/ 
    // This script is free to use as long as you  
    // retain the credit link  
    
    // get posted data into local variables
    $EmailFrom = "Sito Web";
    $EmailTo = "miaemail@miaemail.com";
    $Subject = "Email dal modulo ISCRIVITI";
    $Nome = Trim(stripslashes($_POST['Nome'])); 
    $Cognome = Trim(stripslashes($_POST['Cognome'])); 
    $Email = Trim(stripslashes($_POST['Email'])); 
    $Citta = Trim(stripslashes($_POST['Citta']));
    $Provincia = Trim(stripslashes($_POST['Provincia']));
    $Indirizzo = Trim(stripslashes($_POST['Indirizzo']));
    $Telefono = Trim(stripslashes($_POST['Telefono']));
    $Cellulare = Trim(stripslashes($_POST['Cellulare']));
    $Messaggio = Trim(stripslashes($_POST['Messaggio'])); 
    
    // validation
    $validationOK=true;
    if (!$validationOK) {
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
      exit;
    }
    
    // prepare email body text
    $Body = "";
    $Body .= "Nome: ";
    $Body .= $Nome;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Cognome: ";
    $Body .= $Cognome;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Email: ";
    $Body .= $Email;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Citta': ";
    $Body .= $Citta;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Provincia: ";
    $Body .= $Provincia;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Indirizzo: ";
    $Body .= $Indirizzo;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Telefono: ";
    $Body .= $Telefono;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Cellulare: ";
    $Body .= $Cellulare;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Messaggio: ";
    $Body .= $Messaggio;
    $Body .= "\n";
    
    // send email 
    $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
    
    // redirect to success page 
    if ($success){
      print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
    }
    else{
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
    }
    ?>
    Questa il form nella pagina:
    codice:
    <form method="POST" action="contatti.php">
          <table width="350" border="0" align="center" cellpadding="0" cellspacing="0" class="tab-contenuto">
      <tr>
        <td width="20%" height="30">Nome:</td>
        <td width="80%">
          <label>
            <input type="text" name="Nome" class="campo">
          </label>
        </td>
      </tr>
      <tr>
        <td height="30">Cognome:</td>
        <td><label>
         <input type="text" name="Cognome" class="campo">
        </label></td>
      </tr>
      <tr>
        <td height="30">Email:</td>
        <td><input type="text" name="Email" class="campo"></td>
      </tr>
      <tr>
        <td height="30">Città:</td>
        <td><input type="text" name="Citta" class="campo"></td>
      </tr>
      <tr>
        <td height="30">Provincia:</td>
        <td><input type="text" name="Provincia" class="campo"></td>
      </tr>
      <tr>
        <td height="30">Indirizzo:</td>
        <td><input type="text" name="Indirizzo" class="campo"></td>
      </tr>
      <tr>
        <td height="30">Telefono:</td>
        <td><input type="text" name="Telefono" class="campo"></td>
      </tr>
      <tr>
        <td height="30">Cellulare:</td>
        <td><input type="text" name="Cellulare" class="campo"></td>
      </tr>
      <tr>
        <td height="30">Messaggio:</td>
        <td><textarea name="Messaggio" rows="5" class="campo"></textarea></td>
      </tr>
      <tr>
        <td height="30"></td>
        <td><label>
          <input type="submit" name="submit" value="Invia" class="pulsante">
        
          <input type="submit" name="Submit" value="Cancella" class="pulsante">
        </label></td>
      </tr>
    </table></form>
    Questo form funziona se inserisco la mia email.
    Quando vado ad inserire la mia seconda email di Libero oppure l'email del cliente (la quale è stata creata con Gmail) il modulo non funziona più.

    E' un codice poco affidabile?

  2. #2
    Utente bannato
    Registrato dal
    May 2008
    Messaggi
    267
    So che il discorso "modulo email" è già stato trattato moltissime volte...
    Ma nessuno avrebbe voglia e tempo di dare un occhio a il codice postato?


    Grazie

  3. #3
    Utente di HTML.it L'avatar di polinet
    Registrato dal
    Nov 2000
    Messaggi
    993
    prova cosi:
    Codice PHP:
    <?php
    $from 
    "tua_mail";
    $to "email_destinatario";
    $Subject "Email dal modulo ISCRIVITI";
    $Nome Trim(stripslashes($_POST['Nome'])); 
    $Cognome Trim(stripslashes($_POST['Cognome'])); 
    $Email Trim(stripslashes($_POST['Email'])); 
    $Citta Trim(stripslashes($_POST['Citta']));
    $Provincia Trim(stripslashes($_POST['Provincia']));
    $Indirizzo Trim(stripslashes($_POST['Indirizzo']));
    $Telefono Trim(stripslashes($_POST['Telefono']));
    $Cellulare Trim(stripslashes($_POST['Cellulare']));
    $Messaggio Trim(stripslashes($_POST['Messaggio'])); 
    $headers "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "Content-Transfer-Encoding: 7bit\r\n";
    $headers .= "From: " $from "\r\n"
    // modifica questa riga:
    // send email 
    $success mail($to$Subject$Body$headers );
    // etc....
    ?>
    non ne sono sicuro, comunque provala, a me ha sempre funzionato.
    facci sapere!
    ¿Hasta la pasta?

  4. #4
    Utente bannato
    Registrato dal
    May 2008
    Messaggi
    267
    Non funziona

    Se inserisco la mia email, arriva un email ma vuota senza le informazioni immesse nei campi.
    Se inserisco l'email del cliente (o di Libero) non arriva nulla.


Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.