Add [TEST] and [CRON] labels to distinguish execution source
All checks were successful
Deploy Production Email Reports (Unified) / deploy (push) Successful in 1m0s
All checks were successful
Deploy Production Email Reports (Unified) / deploy (push) Successful in 1m0s
This commit is contained in:
@@ -8,6 +8,7 @@ $dateTimeToday = date("Y-m-d H:i:s");
|
|||||||
|
|
||||||
// Determine which brand to process
|
// Determine which brand to process
|
||||||
$brand = getenv('BRAND') ?: 'crew'; // 'crew' or 'merchbay'
|
$brand = getenv('BRAND') ?: 'crew'; // 'crew' or 'merchbay'
|
||||||
|
$is_test = getenv('TEST_EMAIL') === 'true';
|
||||||
|
|
||||||
// Brand-specific configuration
|
// Brand-specific configuration
|
||||||
$config = [
|
$config = [
|
||||||
@@ -149,14 +150,17 @@ if($result > 0){
|
|||||||
$mail->IsHTML(true);
|
$mail->IsHTML(true);
|
||||||
|
|
||||||
if(!$mail->Send()){
|
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);
|
file_put_contents('email.log', print_r($msg, true), FILE_APPEND);
|
||||||
} else {
|
} 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);
|
file_put_contents('email.log', print_r($msg, true), FILE_APPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} 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);
|
file_put_contents('email.log', print_r($msg, true), FILE_APPEND);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user