Ciao a tutti,
ho un problema con un form php che invia una mail.
Se imposto come un indirizzo di ricezione gmail o tiscali ricevo.
Qualcuno sa aiutarmi???
Non ricevo la mail invece su tin.it
Il codice della pagina è il seguente:
<html>
<head>
<link href="css/style.css" rel="stylesheet" type="text/css">
<title>Richiesta informazioni</title></head>
<body>
<div class="logo2"> [img]img/lamadonnina.gif[/img] </div>
<div class="richiesta">Richiesta informazioni</div>
<div class="form">
<?
// CSS classes & styles
$class_txt = "font:normal 13px Helvetica, Arial, SansSerif;";
$class_inputbutton = "inputButton";
$class_inputline = "inputLine";
$class_inputfield = "inputField";
$style_inputline = "width:305px;";
$style_inputfield = "width:305px;";
$target_address = "non funziona se metto un indirizzo email tin.it";
$email_subject = "Richiesta informazioni dal sito web ";
// error messages
$err_name = "Per favore inserisci il nome.";
$err_surname = "Per favore inserisci il cognome.";
$err_evento = "Per favore inserisci il tipo di evento.";
$err_tipologia = "Per favore inserisci il tipo di servizio richiesto (pranzo, cena).";
$err_dateprev = "Per favore inserisci la data dell'evento.";
$err_persone = "Per favore inserisci il numero di ospiti previsti.";
$err_phone = "Per favore inserisci il numero di telefono.";
$err_msg = "Per favore inserisci la richiesta.";
$err_email = "Per favore inserisci un indirizzo email valido.";
// misc text - modificare il testo rosso per i parametri sul sito
$msg_date = "Data invio";
$msg_name = "Nome";
$msg_surname = "Cognome";
$msg_company = "Società";
$msg_evento = "Evento (matrimonio, coffee break)";
$msg_tipologia = "Tipologia (pranzo, cena)";
$msg_location = "Location";
$msg_dateprev = "Data";
$msg_persone = "N. ospiti previsti";
$msg_phone = "Telefono";
$msg_fax = "Fax";
$msg_email = "Email";
$msg_contatto = "Come preferite essere contattati (e-mail, fax, telefono)";
/*$msg_consenso = "Consenso";*/
/*$msg_answerby = "Reply by";*/
$txt_email = "Email";
$txt_phone = "Telefono";
$txt_post = "Post";
$txt_send = "Invia";
$txt_mandatory = "campi obbligatori";
$msg_request = "Richiesta informazioni";
$msg_indent = 11;
// messages
$txt_thankyou = "<div style='position:absolute; left:0px; top:50px; width:350px; height:60px; z-index:1; color: #000000' class='testo3'>Grazie per averci contattato!
Le risponderemo al più presto.</div>";
$txt_error = "<div style='position:absolute; padding:10px; left:250px; top:0px; width:400px; height:300px; z-index:1; font:bold 14px Helvetica, Arial, SansSerif;color: #fff; background: #ff0000;'>Per inviare la richiesta è necessario:
{errors}
Torna al form</div>"; // {errors} is replaced by the errors that occurred
function spaces($num, $fill=" "){
$foo="";
for ($i=0; $i<$num; $i++) $foo.=$fill;
return $foo;
}
function isValidEmail($addr){
if(eregi("^[a-z0-9]+([_.-][a-z0-9]+)*@([a-z0-9]+([.-][a-z0-9]+)*)+\\.[a-z]{2,4}$", $addr))
return true;
else
return false;
}
// start form evaluation
$error="foo";
if ($_REQUEST['do']=="send"){
$error=false;
if ($_REQUEST['name']=="") $error.="» $err_name
";
if ($_REQUEST['surname']=="") $error.="» $err_surname
";
if ($_REQUEST['evento']=="") $error.="» $err_evento
";
if ($_REQUEST['tipologia']=="") $error.="» $err_tipologia
";
if ($_REQUEST['dateprev']=="") $error.="» $err_dateprev
";
if ($_REQUEST['persone']=="") $error.="» $err_persone
";
if ($_REQUEST['fon']=="") $error.="» $err_phone
";
if ($_REQUEST['message']=="") $error.="» $err_msg
";
if (!isValidEmail($_REQUEST['email'])) $error.="» $err_email
";
if ($error===false){
$message="$msg_date:".spaces($msg_indent-strlen($msg_date)).date("d M Y, H:i", time());
if ($_REQUEST['name']) $message.="\n$msg_name:".spaces($msg_indent-strlen($msg_name)).$_REQUEST['name'];
if ($_REQUEST['surname']) $message.="\n$msg_surname:".spaces($msg_indent-strlen($msg_surname)).$_REQUEST['surname'];
if ($_REQUEST['company']) $message.="\n$msg_company:".spaces($msg_indent-strlen($msg_company)).$_REQUEST['company'];
if ($_REQUEST['evento']) $message.="\n$msg_evento:".spaces($msg_indent-strlen($msg_evento)).$_REQUEST['evento'];
if ($_REQUEST['tipologia']) $message.="\n$msg_tipologia:".spaces($msg_indent-strlen($msg_tipologia)).$_REQUEST['tipologia'];
if ($_REQUEST['location']) $message.="\n$msg_location:".spaces($msg_indent-strlen($msg_location)).$_REQUEST['location'];
if ($_REQUEST['dateprev']) $message.="\n$msg_dateprev:".spaces($msg_indent-strlen($msg_dateprev)).$_REQUEST['dateprev'];
if ($_REQUEST['persone']) $message.="\n$msg_persone:".spaces($msg_indent-strlen($msg_persone)).$_REQUEST['persone'];
if ($_REQUEST['fon']) $message.="\n$msg_phone:".spaces($msg_indent-strlen($msg_phone)).$_REQUEST['fon'];
if ($_REQUEST['fax']) $message.="\n$msg_fax:".spaces($msg_indent-strlen($msg_fax)).$_REQUEST['fax'];
if ($_REQUEST['contatto']) $message.="\n$msg_contatto:".spaces($msg_indent-strlen($msg_contatto)).$_REQUEST['contatto'];
$message.="\n$msg_email:".spaces($msg_indent-strlen($msg_email))."mailto:".$_REQUEST['email'];
/* eliminazione risposta come
$message.="\n\n".spaces(strlen("$msg_answerby ".$_REQUEST['kontakt'])+1, "=");
$message.="\n$msg_answerby ".$_REQUEST['kontakt']."!\n";
$message.=spaces(strlen("$msg_answerby ".$_REQUEST['kontakt'])+1, "="); */
$message.="\n\n$msg_request:\n\n".$_REQUEST['message'];
mail($target_address, $email_subject, $message, "From: ".$_REQUEST['email']);
echo $txt_thankyou;
}else if ($error!==false) $error=str_replace("{errors}", $error, $txt_error);
}
if ($error!==false){
if($error!="foo") echo $error;
// form
echo "<script language='JavaScript' type='text/JavaScript'>\n";
echo "window.onload = function(){ document.form1.name.focus(); }\n";
echo "</script>\n";
echo "<form name='form1' method='post' action=''>\n";
echo "<table border='0' cellpadding='1' cellspacing='0' class='codform'>\n";
echo "<tr><td></td>\n";
echo "</td></tr>\n";
echo "<tr><td width='250' class='testo3'>$msg_name*</td>\n";
echo "<td height='30'><input name='name' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['name']."'>\n";
echo "</td></tr>\n";
echo "<tr><td width='250' class='testo3'>$msg_surname*</td>\n";
echo "<td height='30'><input name='surname' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['surname']."'>\n";
echo "</td></tr>\n";
echo "<tr><td width='250' class='testo3'>$msg_company</td>\n";
echo "<td height='30'><input name='company' id='company' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['company']."'>\n";
echo "</td></tr>\n";
echo "<tr><td width='250' class='testo3'>$msg_evento*</td>\n";
echo "<td height='30'><input name='evento' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['evento']."'>\n";
echo "</td></tr>\n";
echo "<tr><td width='250' class='testo3'>$msg_tipologia*</td>\n";
echo "<td height='30'><input name='tipologia' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['tipologia']."'>\n";
echo "</td></tr>\n";
echo "<tr><td width='250' class='testo3'>$msg_location</td>\n";
echo "<td height='30'><input name='location' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['location']."'>\n";
echo "</td></tr>\n";
echo "<tr><td width='250' class='testo3'>$msg_dateprev*</td>\n";
echo "<td height='30'><input name='dateprev' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['dateprev']."'>\n";
echo "</td></tr>\n";
echo "<tr><td width='250' class='testo3'>$msg_persone*</td>\n";
echo "<td height='30'><input name='persone' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['persone']."'>\n";
echo "</td></tr>\n";
echo "<tr><td width='250' class='testo3'>$msg_phone*</td>\n";
echo "<td height='30'><input name='fon' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['fon']."'>\n";
echo "</td></tr>\n";
echo "<tr><td width='250' class='testo3'>$msg_fax</td>\n";
echo "<td height='30'><input name='fax' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['fax']."'>\n";
echo "</td></tr>\n";
echo "<tr><td width='250' class='testo3'>$msg_email*</td>\n";
echo "<td height='30'><input name='email' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['email']."'>\n";
echo "</td></tr>\n";
echo "<tr><td width='250' class='testo3'>$msg_contatto</td>\n";
echo "<td height='30'><input name='contatto' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['contatto']."'>\n";
echo "</td></tr>\n";
/*echo "<tr><td width='250' class='testo3'>$msg_answerby*</td>\n";
echo "<td height='30' class='testo3'><input name='kontakt' type='radio' value='$txt_email' checked> $txt_email\n";
echo "<input name='kontakt' type='radio' value='$txt_phone'> $txt_phone\n";
echo "<input name='kontakt' type='radio' value='$txt_post'> $txt_post\n";
echo "</td></tr>\n"; */
echo "<tr><td width='250' class='testo3'>$msg_request*</td>\n";
echo "<td height='30'><textarea name='message' cols='45'style='$style_inputfield' rows='10' class='$class_inputfield'>".$_REQUEST['message']."</textarea></td></tr>\n";
echo "<tr><td width='250' ></td>\n";
echo "<td height='30' class='testo3'>* $txt_mandatory</td></tr>\n";
echo "<tr><td width='250' class='testo3'></td>\n";
echo "<td height='30' class='pry'>
Con l'invio del modulo si autorizza ...
</td></tr>\n";
/*echo "<tr><td width='250'></td>\n";
echo "<td height='30' class'pry'><input name='consenso' type='radio' value='".$_REQUEST['consenso']."'>Do il onsenso\n";
echo "</td></tr>\n";
echo "<td height='30' class'pry'><input name='Acconsento' type='radio' value='Acconsento'>Do il consenso
\n";*/
echo "<tr><td width='250'></td>\n";
echo "<td height='30' align='center'><input name='Submit' type='Submit' class='$class_inputbutton' value='$txt_send'>\n";
echo "<input name='do' type='hidden' id='do' value='send'></td>\n";
echo "</tr></table>\n";
echo "</form>\n";
}
/*
######################### END Contact Form ##########################
################################################## ###################
*/
?>
</div>
</body>
</html>
![]()