Met behulp van onderstaande code kan ik een e-mail versturen met als inhoud een aantal rijen in een kolom. Er wordt echter maar 1 kolom weergegeven in de mail terwijl er meer rijen zijn. Weet iemand hoe dit moet ?
PHP:
<?php
require("phpmailer/class.phpmailer.php");
$dbuser = "*******"; // your mysql username
$dbpass = "*******"; // your mysql password
$dbhost = "localhost"; // the host you connect to
$dbname = "************"; // your mysql database name
//-- connect
$dbconn = mysql_connect($dbhost, $dbuser, $dbpass);
//-- select database
mysql_select_db($dbname, $dbconn) or die(mysql_error());
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.zeelandnet.nl"; // SMTP server
$mail->From = "dont-reply@domein.nl";
$mail->FromName = "*********";
$mail->AddAddress("droogers@zeelandnet.nl");
//$headers = "MIME-Version: 1.0\r\n";
// $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$mail->Subject = "Onderwerp";
//$mail->Body = '<table>;
//if (count($_SESSION['winkelwagen']) > 0) {
// foreach ($_SESSION['winkelwagen'] as $id => $aantal) {
$query = "SELECT
tbldatum.Datum,
tblsqlcollecten.Periode,
tblsqlcollecten.doel,
tblinvoerlijstcollectedoelen.Storten_naar,
declaraties_bedrag1 + declaraties_bedrag2 + declaraties_bedrag3 + declaraties_bedrag4 + declaraties_bedrag5 + (`plastic_1,00` * 1 + `plastic_0,50` * 0.5 + papier_500 * 500 + (papier_200 * 200 + papier_100 * 100 + papier_50 * 50 + papier_20 * 20 + papier_10 * 10 + papier_5 * 5 + `2,00` * 2 + `1,00` * 1 + `0,50` * 0.5 + `0,20` * 0.2 + `0,10` * 0.1 + `0,05` * 0.05) * verdeelsleutel) AS totaal,
tblsqlcollecten.ID,
tblinvoerlijstcollectedoelen.Retour
FROM
tblsqlcollecten
INNER JOIN tbldatum ON (tblsqlcollecten.Periode = tbldatum.Periode_nr)
INNER JOIN tblinvoerlijstcollectedoelen ON (tblsqlcollecten.doel = tblinvoerlijstcollectedoelen.Doel)
WHERE
(tblinvoerlijstcollectedoelen.Storten_naar = 'Diaconie')";
$result = mysql_query($query);
$rij = mysql_fetch_object($result);
$mail->Body= 'test<table>
<tr vertical-align="middle">
<td width="100">'.$rij->doel.'</td>
<td>'.$rij->Storten_naar.'</td>
<td align="right" width="50">'.$rij->totaal.'</td>
<td align="center" width="20"></td>
<td align="center" width="20"></td>
</tr>
</table>';
//$mail->AltBody="Alternatieve tekst in mail";
if(!$mail->Send())
{
echo "Er is een fout opgetreden, neem a.u.b. contact op.";
echo "Mailer Error: " . $mail->ErrorInfo;
}
?>
Laatst bewerkt: