ho fatto una cosa al volo dovrebbe funzionare
Codice PHP:
<?php
function is_email($email_to_test)
{
$re = "^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])";
$re .= "+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$";
if (ereg($re, $email_to_test))
{
return TRUE;
}
else
{
return FALSE;
}
}
if(isset($_POST['submit'])){
$nome = trim($_POST['nome']);
$email = trim($_POST['email']);
if($email == "" or (is_email("$email") == TRUE)){
$to = $email;
$subject = "$name ti vuol far conoscere un sito ";
$headers = 'MIME-Version:1.0'."\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: [email]miaemail@email.it[/email]' . "\r\n";
$message ="
<html><body>
Ciao sono $nome:<br \>
Volevo farti conoscere questo sito [url]http://miosito.it[/url]
Io l'ho trovato molto interessante
</body></html>
";
mail($to,$subject,$message,$headers);
echo"Email Inviata";
}else{
echo"Email Inserita Non Valida
<a href=\"suggerisci.php\">Riprova</a>";
}
}else{
?>
<html>
<head>
<title>Suggerisci Sito</title>
<style type="text/css">
label{display:block;}
</style>
</head>
<body>
<form method="post" action="">
<label>Suggerisci Questo Sito</label>
<label>Tuo Nome</label>
<input type="text" name="nome" />
<label>Email Amico</label>
<input type="text" name="email" />
<input type="submit" name="submit" value="Suggerisci" />
</form>
<?php
}
?>
</body>
</html>