$invoice['cost'] = currency_format($invoice['cost']); $invoice['total'] = currency_format($invoice['total']); $emailSendID = $ISL->addEmailSend($invoice['clientid'], $invoiceID, $client['email'], 1); $e = new Emailer(); $e->setMainFile('forms/email_invoice.tpl'); $e->setFrom($SYSTEM['email']['from']); $e->setFromName($SYSTEM['email']['fromName']); $e->setSubject($lang['eml_subj_invoice']); $e->set('SYSTEM', $SYSTEM); $e->set('invoice', $invoice); $e->set('client', $client); $e->set('admin', $admin); $ispayed = strtolower($invoice['curr_status']) == 'fully paid' ? true : false; $e->set('ispayed', $ispayed); $e->fetchMessage(); $e->appendMessage('<img src="' . HTTP_ROOT . 'isop.php?sid=' . $emailSendID . '" width="1" height="1">'); $e->setRecipient($client['email']); $e->setPriority('High'); $result = $e->send(); unset($e); $result = $result ? 'Successful' : 'Failed'; if ($invoice['curr_status'] == 'unsent') { $ISL->UpdateInvoiceStatus($invoiceID, 'pending'); } logItem($_SESSION['ses_client_id'], $invoiceID, 1, 5, $client['email'] . ": " . $result); if (!$passed) { echo "Mail to " . $client['email'] . ".<br>Status: " . $result; } } else { if (!$passed) { echo "No invoice ID provided.";