Grazie dell'aiuto,ecco il codice completo, se ci riesci sei un genio del php
Non mi da nessun errore, ma mi invia una email vuota.
Il codice è corretto, l'unico problema è che non riesco a collegare la parte php con l'html
da qui in poi:
<?php
while($rowrisposte=mysql_fetch_array($result_rispo ste)){
Codice PHP:
// INIZIO SCRIPT PHPMAILER
require "../phpmailer/class.phpmailer.php";
$messaggio = new PHPmailer();
//intestazioni e corpo dell'email
$messaggio->From= ''.$rowutente["email"].'';
$messaggio->FromName= ''.$rowutente["nome"].' '.$rowutente["cognome"].'';
$messaggio->AddReplyTo(''.$rowutente["email"].'');
$messaggio->Subject="Riepilogo test";
$messaggio->AddAddress("sito@sito.it");
$messaggio->AddAddress(''.$rowutente["email"].'');
$messaggio->Sender= ''.$rowutente["email"].'';
$messaggio->AddEmbeddedImage('/web/htdocs/www.sito.it/home/images/fondo_email.jpg', 'ciccio', 'fondo_email.jpg', 'base64', 'image/jpeg');
//inseriamo i tag HTML e i CSS per formattare il messaggio
$html_body = '
<html>
<head>
<style>
.testo1{text-align:right;color: #CF150E; FONT-FAMILY: Verdana; FONT-SIZE: 15px; TEXT-DECORATION: none; font-weight:bold}
.testo2{text-align:right;color: #000000; FONT-FAMILY: Verdana; FONT-SIZE: 12px; TEXT-DECORATION: none; font-weight:bold}
.testo3{text-align:right;color: #666666; FONT-FAMILY: Verdana; FONT-SIZE: 12px; TEXT-DECORATION: none; font-weight:bold}
a.testo3:link {BACKGROUND: none; COLOR: #666666; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold}
a.testo3:active {BACKGROUND: none; COLOR: #666666; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold}
a.testo3:visited {BACKGROUND: none; COLOR: #666666; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold}
a.testo3:hover {BACKGROUND: none; COLOR: #000000; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold}
</style>
</head>
<body>
<table width="700" height="10" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right" background="http://www.sito.it/images/fondo_email.jpg">
<table width="680" height="600" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="660" height="160"></td>
<td width="20" rowspan="16"></td>
</tr>
<tr>
<td height="50" align="right" class="testo1">
Gentile '.$rowutente["ragione_sociale"].''.$rowutente["nome"].' '.$rowutente["cognome"].'
abbiamo ricevuto correttamente il tuo test.</p>
A seguire le tue risposte:</p></td>
</tr>
<tr>
<td height="5" align="right"></td>
</tr>
<?php
while($rowrisposte=mysql_fetch_array($result_risposte)){
$idcorsieventodomande = $rowrisposte["id_corsi_evento_domande"];
echo $idcorsieventodomande;
echo $rowrisposte["domanda"];
$query_risposte2="SELECT d_corsi_evento_domande.*, d_corsi_evento_risposte.*
FROM d_corsi_evento_domande
INNER JOIN d_corsi_evento_risposte
ON d_corsi_evento_domande.id_corsi_evento_domande = d_corsi_evento_risposte.id_corsi_evento_domande
AND d_corsi_evento_risposte.id_corsi_evento_domande = $idcorsieventodomande";
$result_risposte2=mysql_query($query_risposte2, $conn) or die ("errore ".mysql_error());
$rowrisposte2=mysql_fetch_array($result_risposte2);
?>
<tr>
<td height="15" align="right" class="testo2">domanda: '.$rowrisposte["domanda"].'</td>
</tr>
<?php
if ($rowrisposte2["risposta_ute"] == 1){
?>
<tr>
<td height="15" align="right" class="testo2">risposta: '.$rowrisposte["risposta_1"].'</td>
</tr>
<?php
} elseif($rowrisposte2["risposta_ute"] == 2){
?>
<tr>
<td height="15" align="right" class="testo2">risposta: '.$rowrisposte["risposta_2"].'</td>
</tr>
<?php
} elseif($rowrisposte2["risposta_ute"] == 3){
?>
<tr>
<td height="15" align="right" class="testo2">risposta: '.$rowrisposte["risposta_3"].'</td>
</tr>
<?php
}
?>
<tr>
<td height="10"> </td>
</tr>
<?php
}
?>
<tr>
<td height="15" align="right"> </td>
</tr>
<tr>
<td height="15" align="right" class="testo1">
</td>
</tr>
<tr>
<td height="65" align="right"></td>
</tr>
<tr>
<td height="10" align="right" class="testo3">
Dopo che il nostro staff avrà controllato il tuo test ti invieremo una email con i risultati.
Ti aspettiamo sul sito [url="http://www.sito.it"][url]www.sito.it[/url][/url]
Con i nostri migliori saluti,
Servizio Clienti
</td>
</tr>
<tr>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
';
//settiamo il metodo che indica alla classe
//il formato HTML
$messaggio->MsgHTML($html_body);
$messaggio->AltBody="Per poter leggere correttamente questo messaggio è indispensabile che il tuo client di posta elettronica sia abilitato per l'html";
//parte relativa all'invio
if(!$messaggio->Send()){
echo $messaggio->ErrorInfo;
}else{
echo '';
}