if(isset($_POST['mail']))
{
$email = trim(stripslashes($_POST['mail']));
$mittente = trim(stripslashes($_POST['mittente']));
$messaggio = trim(stripslashes(nl2br($_POST['richiesta'])));
//queste le ho asteriscate perchè non mi sono servite
//$mess = str_replace("à", "à", $messaggio);
//$messaggio = str_replace("è", "e", $messaggio);
//$messaggio = str_replace("é", "e", $messaggio);
//$messaggio = str_replace("ì", "i", $messaggio);
//$messaggio = str_replace("ò", "o", $messaggio);
//$messaggio = str_replace("ù", "u", $messaggio);
// Genera un boundary
$mail_boundary = "=_NextPart_" . md5(uniqid(time()));
// inserire mail destinatario
$to = "pippo@hotmail.it";
$subject = "Informazioni ";
// inserire mail mittente
$sender = "$email";
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$headers = "From: $sender\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative;\n\tboundary=\"$mail_boundary\"\n";
$headers .= "X-Mailer: PHP " . phpversion();
$html_msg = " <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<HTML>
<HEAD>
<META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\">
</HEAD>
<BODY>
<table cellspacing = '0' cellpadding = '0' border = '0'>
<tr>
<td valign = 'top' height= '40'>
<font face = 'Comic Sans MS' size = '4'>
Richiesta Informazioni
</font>
</td>
</tr>
<tr>
<td>
<font face = 'Comic Sans MS, Verdana' size = '2'>
<b>Informazioni sul richiedente</b><br>
Nome: $mittente<br>
Indirizzo e-mail: $email<br><br>
<b>Messaggio</b><br>
$messaggio<br><br>
</font><br><br><br>
</td>
</tr>
</table>
</BODY>
</HTML>";
$msg .= "\n--$mail_boundary\n";
$msg .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$msg .= "Content-Transfer-Encoding: 8bit\n\n";
$msg .= $html_msg; // aggiungi il messaggio in formato HTML
// Boundary di terminazione multipart/alternative
$msg .= "\n--$mail_boundary--\n";
// Imposta il Return-Path (funziona solo su hosting Windows)
ini_set("sendmail_from", $sender);
// Invia il messaggio, il quinto parametro "-f$sender" imposta il Return-Path su hosting Linux
if (mail($to, $subject, $msg, $headers, "-f$sender"))
{
header('location:'.'index.php?settore=risp_ok');
exit;
}
else
{
header('location:'.'index.php?settore=risp_ko');
exit;
}
}
else
{
header('location:'.'index.php');
exit;
}