Cosi dovrebbe funzionare senza problemi:
Codice PHP:
<?php
$receiverMail = "svm@alpsnc.it";
$nome = trim(strip_tags(stripslashes($_POST['nome'])));
$cognome = trim(strip_tags(stripslashes($_POST['cognome'])));
$email = trim(strip_tags(stripslashes($_POST['email']))));
$telefono = trim(strip_tags(stripslashes($_POST['telefono'])));
$persone = trim(strip_tags(stripslashes($_POST['persone'])));
$periodo = trim(strip_tags(stripslashes($_POST['periodo'])));
$note = trim(strip_tags($_POST['note']));
$ip = getenv("REMOTE_ADDR");
$msgformat = "From: ".$nome." ".$cognome." (".$ip.")\nEmail: ".$email."\n\n".$msg;
// VALIDATION
if(empty($nome) || empty($cognome) || empty($email) || empty($telefono)) {
echo "[b]Errore:[/b]
E' necessario compilare i campi "nome" "cognome" "telefono" e "email" per poterVi rispondere.
<a href=\"javascript:window.history.back()\">TORNA</a>";
}
elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
echo "[b]Errore:[/b]
L'indirizzo e-mail inserito non è valido.
<a href=\"javascript:window.history.back()\">TORNA</a>";
}
else {
mail($receiverMail, $subject, $msgformat, "From: ".$nome." ".$cognome." <".$email.">");
echo "[b]Messaggio inviato![/b]
Grazie per averci contattato.
Tana dell'Istrice risponderà quanto prima!
<a href=\"prenotazioni.htm\" target=\"_self\">NUOVO MESSAGGIO</a>"; }
?>