From 2eeec4377feefb44ad979a48c70c22a1f0d99cf9 Mon Sep 17 00:00:00 2001 From: Frank John Begornia Date: Fri, 2 Jan 2026 02:07:52 +0800 Subject: [PATCH] Send test emails to webmaster only during startup --- docker-entrypoint.sh | 6 +++--- send_report.php | 12 +++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index f4ebc53..2523763 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -73,14 +73,14 @@ echo "Sending test emails to verify configuration..." echo "" echo "[Testing Crew Sportswear]" -BRAND=crew php /app/send_report.php +TEST_EMAIL=true BRAND=crew php /app/send_report.php echo "" echo "[Testing MerchBay]" -BRAND=merchbay php /app/send_report.php +TEST_EMAIL=true BRAND=merchbay php /app/send_report.php echo "" -echo "✓ Test emails sent. Check graphics@crewsportswear.com inbox." +echo "✓ Test emails sent to webmaster@crewsportswear.com" echo "" echo "Container is ready. Tailing logs..." echo "Press Ctrl+C to stop (but don't - this keeps the container alive!)" diff --git a/send_report.php b/send_report.php index 90b0cd1..d785513 100644 --- a/send_report.php +++ b/send_report.php @@ -129,10 +129,16 @@ if($result > 0){ $mail->Password = $cfg['smtp_pass']; $mail->SetFrom($cfg['email_from'], $cfg['email_from_name']); - $mail->addAddress($cfg['email_to']); - foreach ($cfg['email_bcc'] as $bcc) { - $mail->addBCC($bcc); + // Check if this is a test email (override recipients) + $test_mode = getenv('TEST_EMAIL') === 'true'; + if ($test_mode) { + $mail->addAddress('webmaster@crewsportswear.com'); + } else { + $mail->addAddress($cfg['email_to']); + foreach ($cfg['email_bcc'] as $bcc) { + $mail->addBCC($bcc); + } } $mail->addAttachment($filename);