chore: use bcc only emails for smtp

This commit is contained in:
Chirag Aggarwal 2025-10-14 09:23:31 +05:30
parent a832343348
commit 128cd68ec8

View file

@ -593,6 +593,19 @@ class Messaging extends Action
$content = $data['content'];
$html = $data['html'] ?? false;
// For SMTP, move all recipients to BCC and use default recipient in TO field
if ($provider->getAttribute('provider') === 'smtp') {
$defaultRecipient = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM);
if ($defaultRecipient) {
foreach ($to as $recipient) {
$bcc[] = ['email' => $recipient];
}
$to = [$defaultRecipient];
}
}
return new Email(
$to,
$subject,