how to code functions and other php code in email source
Hello,
I have an email that sends out a list of outstanding invoices but it is not doing the calculation of dates as it does in a regular PHP page.
Here's the snippet of code in the email source:
$MailBody = $MailBody . "\r\n";
$MailBody = $MailBody . $now = time();
$MailBody = $MailBody . $invoiceDate = strtotime($rsSummaryOpen->getColumnVal("invDate"));
$MailBody = $MailBody . $difference = $now - $invoiceDate;
$MailBody = $MailBody . floor($difference/(60*60*24));
$MailBody = $MailBody . "\r\n";
$MailBody = $MailBody . " </div></td>\r\n";
$MailBody = $MailBody . " </tr>\r\n";
$MailBody = $MailBody . " ";
Here's the basic code that works fine in a basic PHP page:
<?php $now = time(); ?>
<?php
$invoiceDate = strtotime($rsSummaryOpen->getColumnVal("invDate"));
$difference = $now - $invoiceDate;
echo floor($difference/(60*60*24));
?>
Attached screen shots show the results in email and in the basic php page.
Any tips on how to format this in the email file so it works like the regular page?