diff --git a/app/Maildispatcher/Data/MailEntry.php b/app/Maildispatcher/Data/MailEntry.php index b93d9777..e54c7a3d 100644 --- a/app/Maildispatcher/Data/MailEntry.php +++ b/app/Maildispatcher/Data/MailEntry.php @@ -8,5 +8,6 @@ class MailEntry extends Data { public function __construct(public string $email) { + $this->email = strtolower($email); } } diff --git a/tests/Feature/Maildispatcher/StoreTest.php b/tests/Feature/Maildispatcher/StoreTest.php index 6fdd1ebe..47b850be 100644 --- a/tests/Feature/Maildispatcher/StoreTest.php +++ b/tests/Feature/Maildispatcher/StoreTest.php @@ -3,6 +3,7 @@ namespace Tests\Feature\Maildispatcher; use App\Activity; +use App\Maildispatcher\Models\Localmaildispatcher; use App\Maildispatcher\Models\Maildispatcher; use App\Mailgateway\Models\Mailgateway; use App\Mailgateway\Types\LocalType; @@ -48,4 +49,18 @@ class StoreTest extends TestCase 'to' => 'jane@example.com', ]); } + + public function testMaildispatcherReceivesLowerVersionOfEmail(): void + { + $gateway = Mailgateway::factory()->type(LocalType::class, [])->create(); + Member::factory()->defaults()->create(['email' => 'Jane@example.com']); + + $this->postJson('/maildispatcher', [ + 'name' => 'test', + 'gateway_id' => $gateway->id, + 'filter' => [], + ]); + + $this->assertEquals('jane@example.com', Localmaildispatcher::first()->to); + } }