Ciao a tutti,
come da oggetto, ho un codice php che invia un'email ad una serie di destinatari.
L'email arriva nel seguente modo:

Ciao,<br />
sono un testo<br />
<br />
ciao

Mi aiutate a capire dove sto sbagliando?? Ecco il codice:

<?php
....

$mittente = $_POST['mittente'];
$destinatario = $row_iscritti['email'];
$oggetto = $_POST['oggetto'];
$messaggio = nl2br($_POST['messaggio']);
$allegato = $_FILES['allegato']['tmp_name'];
$allegato_type = $_FILES['allegato']['type'];
$allegato_name = $_FILES['allegato']['name'];


$headers = "From: " . $mittente;
$msg = "";
if (is_uploaded_file($allegato))
{
$file = fopen($allegato,'rb');
$data = fread($file, filesize($allegato));
fclose($file);
$data = chunk_split(base64_encode($data));


$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

$headers .= "\nMIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed;\n";
$headers .= " boundary=\"{$mime_boundary}\"";


$msg .= "This is a multi-part message in MIME format.\n\n";


$msg .= "--{$mime_boundary}\n";


$msg .= "Content-Type: text/html; charset=\"UTF-8\"\n";
$msg .= "Content-Transfer-Encoding: 7bit\n\n";
$msg .= $messaggio . "\n\n";


$msg .= "--{$mime_boundary}\n";


$msg .= "Content-Disposition: attachment; filename=\"{$allegato_name}\"\n";
$msg .= "Content-Transfer-Encoding: base64\n\n";
$msg .= $data . "\n\n";


$msg .= "--{$mime_boundary}--\n";
}

.....

?>
Grazie in anticipo.