From 2a857d2bfa9023d8c119e32c704b44ba14407249 Mon Sep 17 00:00:00 2001 From: Frank John Begornia Date: Sun, 4 Jan 2026 13:56:14 +0800 Subject: [PATCH] Add [TEST] and [CRON] labels to distinguish execution source --- send_report.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/send_report.php b/send_report.php index d785513..399d28c 100644 --- a/send_report.php +++ b/send_report.php @@ -8,6 +8,7 @@ $dateTimeToday = date("Y-m-d H:i:s"); // Determine which brand to process $brand = getenv('BRAND') ?: 'crew'; // 'crew' or 'merchbay' +$is_test = getenv('TEST_EMAIL') === 'true'; // Brand-specific configuration $config = [ @@ -149,14 +150,17 @@ if($result > 0){ $mail->IsHTML(true); if(!$mail->Send()){ - $msg = $dateTimeToday . "\t\t\t{$cfg['log_prefix']} Mailer Error: " . $mail->ErrorInfo . "\n"; + $test_label = $is_test ? ' [TEST]' : ' [CRON]'; + $msg = $dateTimeToday . "\t\t\t{$cfg['log_prefix']}{$test_label} Mailer Error: " . $mail->ErrorInfo . "\n"; file_put_contents('email.log', print_r($msg, true), FILE_APPEND); } else { - $msg = $dateTimeToday . "\t\t\t{$cfg['log_prefix']} successfully sent ({$result} orders)\n"; + $test_label = $is_test ? ' [TEST]' : ' [CRON]'; + $msg = $dateTimeToday . "\t\t\t{$cfg['log_prefix']}{$test_label} successfully sent ({$result} orders)\n"; file_put_contents('email.log', print_r($msg, true), FILE_APPEND); } } else { - $msg = $dateTimeToday . "\t\t\t{$cfg['log_prefix']} No order for today\n"; + $test_label = $is_test ? ' [TEST]' : ' [CRON]'; + $msg = $dateTimeToday . "\t\t\t{$cfg['log_prefix']}{$test_label} No order for today\n"; file_put_contents('email.log', print_r($msg, true), FILE_APPEND); }