<?php
require("class.phpmailer.php");
$nome = $_POST["nome"];
$cognome = $_POST["cognome"];
$telefono = $_POST["telefono"];
$email = $_POST["email"];
$testo = $_POST["testo"];
$nomemittente = $nome . ' ' . $cognome;
$messaggio = "<div style=\"font-family:Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #000000;\"><br><br><br><br>
<strong>Nome:</strong> " . $nome . "<br>
<strong>Cognome:</strong> " . $cognome . "<br>
<strong>Telefono:</strong> " . $telefono . "<br>
<strong>E-mail:</strong> " . $email . "<br><br>
<strong>Testo:</strong> " . $testo . "<br><br>
</div>";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.esempio.com";
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->Username = "smtp@esempio.com";
$mail->Password = "password";
$mail->From = "$email";
$mail->FromName = "$nomemittente";
$mail->AddAddress("mioindirizzo@miodominio.com");
$mail->AddReplyTo("$email", "$nome");
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = "$nomemittente - Richiesta informazioni";
$mail->Body = "$messaggio</b>";
if(strpos($testo,'http') !== false || strpos($testo,'www') !== false || strpos($testo,'HTTP') !== false || strpos($testo,'WWW') !== false){
header('Location: contatti-spam.html');
exit();
}elseif($nome == "" || $cognome == "" || $email == "" || $testo == ""){
header('Location: contatti-campi.html');
exit();
}else{
if($mail->Send()){
header('Location: contatti-ok.html');
exit();
}else{
header('Location: contatti-errore.html');
exit();
}
}
?>