yes my mailer class accept attachment and i have tested it already by attaching a file from my c: drive and it works , but getting data from the database its a problem
$mail->AddAttachment("c:/temp/thl.xls", "thl.xls");
I am trying to modify my script and getting to learn more bout excel spreadsheet this script works perfectly It open an text.xls file with the info form my database but how do i make this info emailed the email still goes through but there is no attachment , anyone to help me pls
<?php
require_once ('paths.php');
require (CONNECTIONS.'db_conn.php');
// processing finished, lets create the system logs (if there are any) and e-mail them
require_once ("Spreadsheet/Excel/Writer.php");
require (CLASSES.'class.phpmailer.php');
require(CLASSES.'class.smtp.php');
$workbook = new Spreadsheet_Excel_Writer();
$format_bold =& $workbook->addFormat();
$format_bold->setBold();
$worksheet =& $workbook->addWorksheet();
$worksheet->write(0, 0, "Branch", $format_bold);
$worksheet->write(0, 1, "WaybillDate", $format_bold);
$worksheet->write(0, 2, "WaybillNumber", $format_bold);
$worksheet->write(0, 3, "Customer Reference", $format_bold);
$worksheet->write(0, 4, "To_Ops_Branch", $format_bold);
$worksheet->write(0, 5, "Route", $format_bold);
$worksheet->write(0, 6, "Account Number", $format_bold);
$worksheet->write(0, 7, "Customer Name", $format_bold);
$worksheet->write(0, 8, "Service Type", $format_bold);
$worksheet->write(0, 9, "Scan Back Reason Code", $format_bold);
$worksheet->write(0, 10, "POD Date", $format_bold);
$worksheet->write(0, 11, "Date Invoiced Received", $format_bold);
# start by opening a query string
$fullquery="select * from Internal_Docs_waybills_outstanding";
$result=mysql_query($fullquery);
$i=1;
while($row=mysql_fetch_array($result)){
$worksheet->write($i, 0, "$row[Branch]");
$worksheet->write($i, 1, "$row[Waybill_Date]");
$worksheet->write($i, 2, "$row[WaybillNumber]");
$worksheet->write($i, 3, "$row[Customer_Reference]");
$worksheet->write($i, 4, "$row[To_Ops_Branch]");
$worksheet->write($i, 5, "$row[Route]");
$worksheet->write($i, 6, "$row[Account_Number]");
$worksheet->write($i, 7, "$row[Customer_Name]");
$worksheet->write($i, 8, "$row[Service_Type]");
$worksheet->write($i, 9, "$row[Sacn_Back_Reason_Code]");
$worksheet->write($i, 10, "$row[POD_Date]");
$worksheet->write($i, 11, "$row[Date_Invoiced_Received]");
$i++;
}
$workbook->send('test.xls');
$workbook->close();
?>
and someone told me to create a physical file on the server then run cron tab to empty the file . I am still searching on how to do that , pls your assistance will be highly appriciated