From 7be0fe012041283df651c1fbce7b3f69102a500f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Falc=C3=B3n?= Date: Tue, 7 Apr 2026 13:50:42 +0100 Subject: [PATCH] fix: make transaction sync email use default sender (#265) ## Summary - explicitly set the transaction sync mailable sender to the configured default transactional address - add a regression test so the transaction sync email cannot fall back to an unintended sender ## Testing - php artisan test --compact tests/Feature/MailSenderTest.php --- app/Mail/BankTransactionsSyncedEmail.php | 5 +++++ tests/Feature/MailSenderTest.php | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/app/Mail/BankTransactionsSyncedEmail.php b/app/Mail/BankTransactionsSyncedEmail.php index 4e85c8bd..afad45ab 100644 --- a/app/Mail/BankTransactionsSyncedEmail.php +++ b/app/Mail/BankTransactionsSyncedEmail.php @@ -6,6 +6,7 @@ use App\Models\User; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Mail\Mailable; +use Illuminate\Mail\Mailables\Address; use Illuminate\Mail\Mailables\Content; use Illuminate\Mail\Mailables\Envelope; use Illuminate\Queue\Middleware\RateLimited; @@ -43,6 +44,10 @@ class BankTransactionsSyncedEmail extends Mailable implements ShouldQueue public function envelope(): Envelope { return new Envelope( + from: new Address( + config('mail.from.address', 'no-reply@whisper.money'), + config('mail.from.name', 'Whisper Money'), + ), subject: __(':count new transactions synced on Whisper Money', ['count' => $this->totalTransactions]), ); } diff --git a/tests/Feature/MailSenderTest.php b/tests/Feature/MailSenderTest.php index e25ff737..ae92db01 100644 --- a/tests/Feature/MailSenderTest.php +++ b/tests/Feature/MailSenderTest.php @@ -129,6 +129,14 @@ test('default sender is used for active non-drip mailables', function (string $m WaitlistOvertaken::class, ]); +test('transaction sync email envelope explicitly uses the default sender', function () { + $user = User::factory()->create(); + + $mailable = new BankTransactionsSyncedEmail($user, 3, ['Test Bank' => 3]); + + expect($mailable->envelope()->from)->toEqual(new Address('no-reply@whisper.money', 'Whisper Money')); +}); + test('verification notification uses the default sender', function () { $user = User::factory()->unverified()->create();