From 128cd68ec8114bd7b98673b7efa857f4a75f839c Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 14 Oct 2025 09:23:31 +0530 Subject: [PATCH 1/4] chore: use bcc only emails for smtp --- src/Appwrite/Platform/Workers/Messaging.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index 668993fdae..8c62ae32b8 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -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, From 752520470d858fb6adea17d8b8bfef0534e31400 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 14 Oct 2025 09:27:50 +0530 Subject: [PATCH 2/4] fix: param --- src/Appwrite/Platform/Workers/Messaging.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index 8c62ae32b8..1a714c232c 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -592,18 +592,15 @@ class Messaging extends Action $subject = $data['subject']; $content = $data['content']; $html = $data['html'] ?? false; + $defaultRecipient = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM); // 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]; + foreach ($to as $recipient) { + $bcc[] = ['email' => $recipient]; } + + $to = []; } return new Email( @@ -617,7 +614,8 @@ class Messaging extends Action $cc, $bcc, $attachments, - $html + $html, + $defaultRecipient ); } From 07727298f70dda8f0b89ddd430883d9b71944a0c Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 14 Oct 2025 17:18:44 +0530 Subject: [PATCH 3/4] remove default recepient --- composer.json | 2 +- composer.lock | 14 +++++++------- src/Appwrite/Platform/Workers/Messaging.php | 3 --- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 9042cb088f..79dd9040a6 100644 --- a/composer.json +++ b/composer.json @@ -62,7 +62,7 @@ "utopia-php/image": "0.8.*", "utopia-php/locale": "0.8.*", "utopia-php/logger": "0.6.*", - "utopia-php/messaging": "0.18.*", + "utopia-php/messaging": "0.19.*", "utopia-php/migration": "1.*", "utopia-php/orchestration": "0.9.*", "utopia-php/platform": "0.7.*", diff --git a/composer.lock b/composer.lock index b544b18aab..3608d91b03 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "773efb29b9b584b1249790e0016c823a", + "content-hash": "568800edca746c4e8d0d50648b25f589", "packages": [ { "name": "adhocore/jwt", @@ -4136,16 +4136,16 @@ }, { "name": "utopia-php/messaging", - "version": "0.18.2", + "version": "0.19.0", "source": { "type": "git", "url": "https://github.com/utopia-php/messaging.git", - "reference": "0d364edacf4d4867964c7e17f653031dd39394bf" + "reference": "0b866d54e70c792a3c4f5ca9c12a6d358a31f4b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/messaging/zipball/0d364edacf4d4867964c7e17f653031dd39394bf", - "reference": "0d364edacf4d4867964c7e17f653031dd39394bf", + "url": "https://api.github.com/repos/utopia-php/messaging/zipball/0b866d54e70c792a3c4f5ca9c12a6d358a31f4b8", + "reference": "0b866d54e70c792a3c4f5ca9c12a6d358a31f4b8", "shasum": "" }, "require": { @@ -4181,9 +4181,9 @@ ], "support": { "issues": "https://github.com/utopia-php/messaging/issues", - "source": "https://github.com/utopia-php/messaging/tree/0.18.2" + "source": "https://github.com/utopia-php/messaging/tree/0.19.0" }, - "time": "2025-07-21T18:27:03+00:00" + "time": "2025-10-14T11:46:49+00:00" }, { "name": "utopia-php/migration", diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index 1a714c232c..ffd71cd867 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -592,14 +592,12 @@ class Messaging extends Action $subject = $data['subject']; $content = $data['content']; $html = $data['html'] ?? false; - $defaultRecipient = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM); // For SMTP, move all recipients to BCC and use default recipient in TO field if ($provider->getAttribute('provider') === 'smtp') { foreach ($to as $recipient) { $bcc[] = ['email' => $recipient]; } - $to = []; } @@ -615,7 +613,6 @@ class Messaging extends Action $bcc, $attachments, $html, - $defaultRecipient ); } From 97f448f984645358083d1fb49352cf100309c99d Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 14 Oct 2025 17:19:08 +0530 Subject: [PATCH 4/4] comma --- src/Appwrite/Platform/Workers/Messaging.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index ffd71cd867..abf46e67a4 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -612,7 +612,7 @@ class Messaging extends Action $cc, $bcc, $attachments, - $html, + $html ); }