codice:
<?php
// Invia mail ringraziando
$boundary = strtotime('NOW');
$headers = "From: Site <cris.calleo@g***l.com>n";
$headers .= "MIME-Version: 1.0n";
$headers .= "Content-Type: multipart/mixed; boundary="" . $boundary . ""n";
$msg = "--" . $boundary . "n";
$msg .= "Content-Type: text/html; charset="iso-8859-1"n";
$msg .= "Content-Transfer-Encoding: quoted-printablenn";
$msg .= $mensagem2;
$msg .= "--" . $boundary . "n";
$msg .= "Content-Transfer-Encoding: base64n";
$msg .= "Content-Disposition: attachment; filename="TUOFILE.pdf"nn";
ob_start();
readfile("TUOFILE.pdf");
$enc = ob_get_contents();
ob_end_clean();
$msg_temp = base64_encode($enc). "n";
$tmp[1] = strlen($msg_temp);
$tmp[2] = ceil($tmp[1]/76);
for ($b = 0; $b <= $tmp[2]; $b++) {
$tmp[3] = $b * 76;
$msg .= substr($msg_temp, $tmp[3], 76) . "n";
}
unset($msg_temp, $tmp, $enc);
mail($recebemail, "Il messaggio è stato ricevuto!", $msg, $headers);
echo "<script>alert('E-mail inviato!');</script>";
echo "<meta http-equiv='Refresh' content='0;URL=form_contatto.php' />";
?>