Salve a tutti, ho un problema con un form che non invia i dati in email (formato html), potreste capire dove è sbagliato?
il form in html che si compila è a questa pagina:
http://www.cowese.com/form/form_1.html
quando un utente compila solo i dati obbligatori o comunque tutti quanti, non arriva nessuna email nella mia posta elettronica, qua sotto invece il codice .php per l'invio dei dati
**************** INIZIO CODICE **************************
<?php
###############################
# INIZIO CONFIGURAZIONE #
###############################
//email del destinatario del modulo
$destinatario = "[email protected]";
//nome mittente per la corretta intestazione del modulo
$nome_mittente = "$Cognome_Nome";
//email mittente per per la corretta intestazione del modulo
$email_mittente = "$email";
//oggetto dell'email
$subject = "FORM 1 DI PROVA";
//url della pagina di ringraziamento
$pagina_grazie = "http://www.cowese.com/form/form_1_grazie.html";
#############################
# FINE CONFIGURAZIONE #
#############################
//======================= DA QUA NON TOCCARE NULLA... SE NON VUOI INCASINARE QUALCOSA =======================\
//orario e data
$ora = date ("H:i:s");
$data = date ("d/m/Y");
//formato html in email
$from = "From: $nome_mittente <$email_mittente>\n";
$from .= "CC: $email_mittente\n";
$from .= "MIME-Version: 1.0\n";
$from .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$from .= "Content-Transfer-Encoding: 7bit\n\n";
//intestazione dell'email (arriva al destinatario)
$corpo = "<html><body><span style='font-family: Verdana; font-size: 10pt'>Di seguito i dati inviati il giorno </span><span style='font-family: Verdana; color: rgb(255,0,0); font-size: 10pt;'>$data</span><span style='font-family: Verdana; font-size: 10pt'> alle ore <span style='color: rgb(255,0,0); font-size: 10pt'>$ora</span><br>
---------------------------------------------------------------------------<p></body></html>";
########### CODICE VARIO ###########
//variabili per rendere lo script compatibile anche con PHP 4.2 - copyright di Chris
if(!isset($_SERVER) OR !$_SERVER OR !is_array($_SERVER) OR count(array_diff($_SERVER, $HTTP_SERVER_VARS))){
$_POST = &$HTTP_POST_VARS;
}
//prendo il numero IP
if(isset($_SERVER["HTTP_X_FORWARDED_FOR"])){
if ($_SERVER["HTTP_X_FORWARDED_FOR"] == "") {
$ipnumb = getenv("REMOTE_ADDR");
}else {
$ipnumb = getenv("HTTP_X_FORWARDED_FOR");
}
} else {
$ipnumb = getenv("REMOTE_ADDR");
}
########### VAI CON L'INVIO DELL'EMAIL ###########
foreach($_POST as $key => $valore){
$key = ucfirst(stripslashes(trim($key)));
$valore = stripslashes(trim($valore));
$key = str_replace("_"," ",$key);
if(trim($valore) == "") $valore = "--- non compilato ---";
$corpo .= "<html><body><strong><span style='font-family: Verdana; color: rgb(255,0,0); font-size: 10pt'>$key : </strong></span><span style='font-family: Verdana; font-size: 10pt'> $valore <p>";
}
$corpo .= "---------------------------------------------------------------------------\n\n";
$corpo .= "<br><span style='font-family: Verdana; color: rgb(255,0,0); font-size: 10pt'>Numero IP: </span><span style='font-family: Verdana; font-size: 10pt'>$ipnumb<br></span>";
//inizio l'invio dell'email
mail("$destinatario","$subject","$corpo","$from");
header ("Location: $pagina_grazie");
?>
**************** FINE CODICE **************************
C'è qualcuno che mi possa far capire dove sta l'errore?
Grazie a tutti anticipatamente
il form in html che si compila è a questa pagina:
http://www.cowese.com/form/form_1.html
quando un utente compila solo i dati obbligatori o comunque tutti quanti, non arriva nessuna email nella mia posta elettronica, qua sotto invece il codice .php per l'invio dei dati
**************** INIZIO CODICE **************************
<?php
###############################
# INIZIO CONFIGURAZIONE #
###############################
//email del destinatario del modulo
$destinatario = "[email protected]";
//nome mittente per la corretta intestazione del modulo
$nome_mittente = "$Cognome_Nome";
//email mittente per per la corretta intestazione del modulo
$email_mittente = "$email";
//oggetto dell'email
$subject = "FORM 1 DI PROVA";
//url della pagina di ringraziamento
$pagina_grazie = "http://www.cowese.com/form/form_1_grazie.html";
#############################
# FINE CONFIGURAZIONE #
#############################
//======================= DA QUA NON TOCCARE NULLA... SE NON VUOI INCASINARE QUALCOSA =======================\
//orario e data
$ora = date ("H:i:s");
$data = date ("d/m/Y");
//formato html in email
$from = "From: $nome_mittente <$email_mittente>\n";
$from .= "CC: $email_mittente\n";
$from .= "MIME-Version: 1.0\n";
$from .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$from .= "Content-Transfer-Encoding: 7bit\n\n";
//intestazione dell'email (arriva al destinatario)
$corpo = "<html><body><span style='font-family: Verdana; font-size: 10pt'>Di seguito i dati inviati il giorno </span><span style='font-family: Verdana; color: rgb(255,0,0); font-size: 10pt;'>$data</span><span style='font-family: Verdana; font-size: 10pt'> alle ore <span style='color: rgb(255,0,0); font-size: 10pt'>$ora</span><br>
---------------------------------------------------------------------------<p></body></html>";
########### CODICE VARIO ###########
//variabili per rendere lo script compatibile anche con PHP 4.2 - copyright di Chris
if(!isset($_SERVER) OR !$_SERVER OR !is_array($_SERVER) OR count(array_diff($_SERVER, $HTTP_SERVER_VARS))){
$_POST = &$HTTP_POST_VARS;
}
//prendo il numero IP
if(isset($_SERVER["HTTP_X_FORWARDED_FOR"])){
if ($_SERVER["HTTP_X_FORWARDED_FOR"] == "") {
$ipnumb = getenv("REMOTE_ADDR");
}else {
$ipnumb = getenv("HTTP_X_FORWARDED_FOR");
}
} else {
$ipnumb = getenv("REMOTE_ADDR");
}
########### VAI CON L'INVIO DELL'EMAIL ###########
foreach($_POST as $key => $valore){
$key = ucfirst(stripslashes(trim($key)));
$valore = stripslashes(trim($valore));
$key = str_replace("_"," ",$key);
if(trim($valore) == "") $valore = "--- non compilato ---";
$corpo .= "<html><body><strong><span style='font-family: Verdana; color: rgb(255,0,0); font-size: 10pt'>$key : </strong></span><span style='font-family: Verdana; font-size: 10pt'> $valore <p>";
}
$corpo .= "---------------------------------------------------------------------------\n\n";
$corpo .= "<br><span style='font-family: Verdana; color: rgb(255,0,0); font-size: 10pt'>Numero IP: </span><span style='font-family: Verdana; font-size: 10pt'>$ipnumb<br></span>";
//inizio l'invio dell'email
mail("$destinatario","$subject","$corpo","$from");
header ("Location: $pagina_grazie");
?>
**************** FINE CODICE **************************
C'è qualcuno che mi possa far capire dove sta l'errore?
Grazie a tutti anticipatamente