Send test emails to webmaster only during startup
All checks were successful
Deploy Production Email Reports (Unified) / deploy (push) Successful in 57s

This commit is contained in:
Frank John Begornia
2026-01-02 02:07:52 +08:00
parent 1c19c86205
commit 2eeec4377f
2 changed files with 12 additions and 6 deletions

View File

@@ -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!)"

View File

@@ -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);