mail() function
Posted: Tue Dec 19, 2006 3:29 pm
quick question regarding the mail() function, ive drawn up a HTML template for an invoice in PHP (as data from a database is used to populate the invoice). on completion of an order id like to email the customer a copy of their invoice.
i was thinking the best way of acheiving this would be to require() the invoice template which generates the HTML code for the invoice and populates it with the customers order data and returns the entire HTML code as a variable.
e.g.
require "Templates/invoice.php";
*-----------------------------------------
//processing in invoice.php returns:
$invoice = "<table>........</table>"
*-----------------------------------------
mail($to, $from, $subject$, $invoice);
that seem like a pretty sound way of doing this?
i was thinking the best way of acheiving this would be to require() the invoice template which generates the HTML code for the invoice and populates it with the customers order data and returns the entire HTML code as a variable.
e.g.
require "Templates/invoice.php";
*-----------------------------------------
//processing in invoice.php returns:
$invoice = "<table>........</table>"
*-----------------------------------------
mail($to, $from, $subject$, $invoice);
that seem like a pretty sound way of doing this?