Quando mando il modulo, le intestazioni ed il body vanno bene xké ho provato a metterle in un file .eml e outlook mi ha aperto tutto, anke l'allegato, cmq ecco la parte di codice:
Codice PHP:
$mittente = $_POST['nome']." <".$_POST['mittente'].">";
$oggetto = "Messaggio dal sito Cral";
$messaggio = stripslashes ($_POST['messaggio']);
$messaggio = nl2br($messaggio);
$body = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<HTML><HEAD>
<META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\">
<META content=\"MSHTML 6.00.2800.1400\" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<STYLE type=text/css>
<!--
img {
border: none;
}
.tah10 {
font-family: Tahoma;
font-size: 10px;
text-decoration: none;
color: #000000;
}
.tah11 {
font-family: Tahoma;
font-size: 11px;
text-decoration: none;
color: #000000;
}
.ver10 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
text-decoration: none;
color: #000000;
}
.ver11 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
text-decoration: none;
color: #000000;
}
.tah9 {
font-family: Tahoma;
font-size: 9px;
text-decoration: none;
color: #000000;
}
.ver9 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
text-decoration: none;
color: #000000;
}
.Stile8 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; text-decoration: none; color: #FFFFFF; font-weight: bold; }
.Stile11 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; text-decoration: none; color: #000000; font-weight: bold; }
-->
</STYLE>
<TABLE height=229 cellSpacing=0 cellPadding=0 width=563 border=0>
<TBODY>
<TR>
<TD colSpan=3><IMG height=28 alt=\"\"
src=\"http://terzag.no-ip.com/cral/images_newsletter/border_up.jpg\"
width=563></TD></TR>
<TR>
<TD colSpan=3><IMG height=75 alt=\"\"
src=\"http://terzag.no-ip.com/cral/images_newsletter/bgitop.jpg\"
width=563></TD></TR>
<TR>
<TD rowSpan=2><IMG height=51 alt=\"\"
src=\"http://terzag.no-ip.com/cral/images_newsletter/4-027_1_03.jpg\"
width=379></TD>
<TD class=Stile8 width=83
background=http://terzag.no-ip.com/cral/images_newsletter/4-027_1_04.jpg
height=27>".date("d/m/Y")."</TD>
<TD rowSpan=2><IMG height=51 alt=\"\"
src=\"http://terzag.no-ip.com/cral/images_newsletter/4-027_1_05.jpg\"
width=101></TD></TR>
<TR>
<TD><IMG height=24 alt=\"\"
src=\"http://terzag.no-ip.com/cral/images_newsletter/4-027_1_06.jpg\"
width=83></TD></TR>
<TR>
<TD colSpan=3><IMG height=51 alt=\"\"
src=\"http://terzag.no-ip.com/cral/images_newsletter/4-027_1_07.jpg\"
width=563></TD></TR>
<TR
background=\"http://terzag.no-ip.com/cral/images_newsletter/4-027_1_08.jpg\">
<TD class=ver10
background=http://terzag.no-ip.com/cral/images_newsletter/4-027_1_08.jpg
bgColor=#ea9901 colSpan=3>
<TABLE cellSpacing=5 cellPadding=5 width=\"100%\" border=0>
<TBODY>
<TR>
<TD>
<P class=Stile11>".$messaggio."</P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY></HTML>";
$intestazioni = "From: $mittente\n";//INTESTAZIONE COMUNE A ENTRAMBI I CASI
if ($allegato_error != 0) {//SE NON E' STATO INSERITO UN ALLEGATO
$intestazioni .= "Content-Type: text/html; charset=us-ascii\n";//INTESTAZIONI PARTE HTML
$msg_body = $body;
} else { //ALTRIMENTI
$boundary = md5(uniqid(time()));//GENERO BOUNDARY
$attach = $_FILES["allegato"]["tmp_name"];
$file_name = $_FILES["allegato"]["name"];
$file_type = $_FILES["allegato"]["type"];
$file_size = $_FILES["allegato"]["size"];
$file = @fopen($attach, "r"); //APRO L'ALLEGATO
$contents = @fread($file, $file_size);//LO LEGGO
$encoded_attach = chunk_split(base64_encode($contents));//LO DIVIDO E CODIFICO A 64BIT
@fclose($file);//INFINE LO CHIUDO
$intestazioni .= "MIME-version: 1.0\n"; //INTESTAZIONI MULTIPART EMAIL
$intestazioni .= "Content-type: multipart/mixed; boundary=\"$boundary\"";
$intestazioni .= "X-attachments: $file_name\n";
$mail_body = "--$boundary\n";
$mail_body .= "Content-Type: text/html; charset=us-ascii\n";//INTESTAZIONI PARTE HTML
$mail_body .= "Content-Transfer-Encoding: 7bit\n\n";
$mail_body .= "$body\n\n";
$mail_body .= "--$boundary\n";
$mail_body .= "Content-type: $file_type; name=\"$file_name\"\n"; //INTESTAZIONI PARTE ALLEGATO
$mail_body .= "Content-Transfer-Encoding: base64\n\n";
$mail_body .= "$encoded_attach\n";
$mail_body .= "--$boundary--\n";
$msg_body = $mail_body;
}
while ($row = mysql_fetch_array($newsletter_sql)) { //PESCA DAL DATABASE TUTTE LE EMAIL
$destinatario = $row['email'];
mail($destinatario, $oggetto, $msg_body, $intestazioni);//MANDA L'EMAIL
}
print "Il messaggio è stato recapitato presso tutti gli iscritti.</p>";