What's the best way to add an array to the message body?
I am using:
Code: Select all
<?php
include ('functions.php5');
require_once "swift/Swift.php";
require_once "swift/Swift/Connection/SMTP.php";
if (!$link = dbconn()) {
echo getHeader();
echo '<p>Error1: ' . mysqli_connect_error() . '</p>';
echo getFooter();
exit;
}
if (!$resultdob = @mysqli_query($link, 'SELECT tbl_staffname.sno, tbl_staffname.abr, tbl_staffname.fname, tbl_staffname.lname, tbl_staffdetail.staff, tbl_staffdetail.dob, tbl_staffdetail.current FROM tbl_staffname, tbl_staffdetail WHERE tbl_staffname.sno=tbl_staffdetail.staff AND tbl_staffdetail.current=\'yes\' AND DAYOFMONTH(tbl_staffdetail.dob)=DAYOFMONTH(CURDATE()) AND MONTH(tbl_staffdetail.dob)=MONTH(CURDATE())')) {
echo getHeader();
echo '<p>Error3: ' . mysqli_error($link) . '.</p>';
echo getFooter();
exit;
}
$i=0;
while ($rowdob = mysqli_fetch_assoc($resultdob)) {
$thename[] = array($rowdob['abr']);
$name[] = $thename[$i][0];
$i++;
}
$swift =& new Swift(new Swift_Connection_SMTP('localhost'));
$message =& new Swift_Message('Birthday Reminder', '<p> This is a quick reminder for birthdays of </p>
<p>' . $name . '</p>
<p>Regards,<br />
Administrator', 'text/html');
$recipients =& new Swift_RecipientList();
$recipients->addTo('RECIPIENT EMAIL', 'NAME');
$swift->batchSend($message, $recipients, 'SENDERS EMAIL');
$swift->disconnect();
exit;
?>