si, scusate, posto il codice
codice:
$file = @fopen($attachment,'rb');
$data = @fread($file, filesize($attachment));
@fclose($file);
$data = chunk_split(base64_encode($data));
$rand = md5(time());
$boundary = "==Multipart_Boundary_x".$rand."x";
$intestazioni .= "\nMIME-Version: 1.0\n";
$intestazioni .= "Content-Type: multipart/alternative;\n";
$intestazioni .= " boundary=\"".$boundary."\"\n";
$testo = $TEXTMAIL;// testo reale dell'email
$messaggio .= "This is a multi-part message in MIME format.\n\n";
$messaggio .= "--".$boundary."\n";
$messaggio .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$messaggio .= "Content-Transfer-Encoding: 8bit\n\n";
$messaggio .= $testo . "\n\n";
$messaggio .= "--".$boundary."\n";
$messaggio .= "Content-Type: {$attachment_type};\n";
$messaggio .= " name=\"{$attachment_name}\"\n";
$messaggio .= "Content-Disposition: attachment;\n";
$messaggio .= " filename=\"".$attachment_name."\"\n";
$messaggio .= "Content-Transfer-Encoding: base64\n\n";
$messaggio .= $data . "\n\n";
$messaggio .= "--".$boundary."--\n";