if (isset($_POST['film']) && $_POST['film']!="") $film=$_POST['film'];
else $film="N/D";
$film=str_replace("\\","",$film);
if (isset($_POST['ora']) && $_POST['ora']!="") $ora=$_POST['ora'];
else $ora="N/D";
//....
//...altre variabili che salto...
//...
$notebar=mysql_real_escape_string($_POST['notebar']);
$notebar=$_POST['notebar'];
$notebar=str_replace("\\r\\n","\n ",$notebar);
$notebar=str_replace("\\","",$notebar);
// INIZIO INVIO E-M@IL
error_reporting(E_ALL);
// Genera un boundary
$mail_boundary = "=_NextPart_" . md5(uniqid(time()));
$to = "destinatario@mail.com";
$subject = "Dettagli";
$sender = "mittente@mail.com";
$headers = "From: $sender\n";
$headers .= "Reply-To:mittente@mail.com\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative;\n\tboundary=\"$mail_boundary\"\n";
$headers .= "X-Mailer: PHP " . phpversion();
// Costruisci il corpo del messaggio da inviare
$msg = "This is a multi-part message in MIME format.\n\n";
$msg .= "--$mail_boundary\n";
$msg .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$msg .= "Content-Transfer-Encoding: 8bit\n\n";
$msg .= "
Titolo: $film
Ora: $ora
Note:
$notebar
Mail inviata il ".date("d-m-Y H:i"); // aggiungi il messaggio in formato text
// 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")) echo "Mail inviata correttamente";
else echo "Mail non inviata";