0) { $sContent = substr($sContent, 0, MAX_CONTENT_SIZE); if (strlen($sFullContent) > MAX_CONTENT_SIZE) { $sContent .= "\n\n... Consult the error log archive for the full list of errors"; } } /** * Email it. * * IF YOU DO NOT WANT TO USE PHPMAILER AND HAVE REMOVED THE require_once() INCLUSION ABOVE, * REMOVE ALL LINES BETWEEN HERE AND THE COMMENT "END OF PHPMAILER" */ //$oMail = new PHPMailer(); /** * If we have SMTP detail held in a constant, use SMTP. Otherwise PHPMailer will default to using mail(); */ //if (defined('SMTP_MAIL_PARAMS')) { // $aSMTP = unserialize(SMTP_MAIL_PARAMS); // // $oMail->IsSMTP(); // set mailer to use SMTP // $oMail->Host = $aSMTP['host']; // specify main and backup server // $oMail->Port = $aSMTP['port']; // specify SMTP port // $oMail->SMTPAuth = $aSMTP['auth']; // turn on SMTP authentication // $oMail->Username = $aSMTP['username']; // SMTP username // $oMail->Password = $aSMTP['password']; // SMTP password //} //$oMail->AddAddress(ERROR_NOTIFY_EMAIL, ''); //$oMail->Body = $sContent; //$oMail->From = ERROR_NOTIFY_FROM_EMAIL; //$oMail->FromName = ERROR_NOTIFY_FROM_NAME; //$oMail->Subject = ERROR_NOTIFY_SUBJECT; //$oMail->Send(); //if ($oMail->ErrorInfo && strlen($oMail->ErrorInfo)) { // $sContent = sprintf("This message has been sent via the backup mail() function call as PHPMailer failed reporting: %s\n\n---\n\n%s", // $oMail->ErrorInfo, // $sContent // ); // mail(ERROR_NOTIFY_EMAIL, ERROR_NOTIFY_SUBJECT, $sContent); //} /** END OF PHPMAILER **/ /** * Uncomment this line to use the default PHP mail() function if not using PHPMailer */ mail(ERROR_NOTIFY_EMAIL, ERROR_NOTIFY_SUBJECT, $sContent); /** * Truncate the error log so we don't email it all again on the next run. */ file_put_contents(ERROR_LOG_FILE,null); /** * We'll copy the full content of the error log to an archive. This is useful for a number * of reasons, not least because we are only emailing a portion of the original errors if * the log file was larger than our given MAX_CONTENT_SIZE - there could be errors in the * full log not included in the email. */ $sHistoricalLogName = sprintf('%s.%s.archive', ERROR_LOG_FILE, date('Y-m')); $sFullContent = sprintf("----- Full content of error log as mailed @ %s -----\n%s\n", date('d/m/Y H:i:s'), $sFullContent); file_put_contents($sHistoricalLogName, $sFullContent, FILE_APPEND); /** * And we're done. */ exit; ?>