1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-16 20:28:28 +01:00

Issue #4986 Added option to send an email when a critical error occurs. (one email per day)

Usage: Add the following to e107_config.php, replacing the email address with your own.

define('e_EMAIL_CRITICAL', 'myemail@somewhere.com');
This commit is contained in:
Cameron 2023-03-23 10:56:56 -07:00
parent 9c3b90d5fa
commit 4d1f1173dd

View File

@ -1127,6 +1127,21 @@ $SYSTEM_DIRECTORY = "e107_system/";</pre>
$file = null;
}
if(defined('e_EMAIL_CRITICAL'))
{
$date = date('r');
$subject = '['. $_SERVER['HTTP_HOST'].'] Critical Error';
$emailLogFile = e_LOG.'criticalErrorEmail'.date('Ymd').'.log';
if(!file_exists($emailLogFile))
{
@mail(e_EMAIL_CRITICAL, $subject, $date."\t\t". strip_tags($message));
@file_put_contents(e_LOG.'criticalErrorEmail'.date('Ymd').'.log', 'Critical Error email sent to '.e_EMAIL_CRITICAL);
}
$message = LAN_ERROR_11; // "Check log for details";
$line = null;
$file = null;
}
if(!defined('HEADERF'))
{