From 68f40bd86c1e3c9509fc0f45e635b958c5b105b4 Mon Sep 17 00:00:00 2001 From: Will Browning Date: Fri, 14 Jan 2022 16:46:15 +0000 Subject: [PATCH] Fixed #249 --- app/Rules/NotLocalRecipient.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Rules/NotLocalRecipient.php b/app/Rules/NotLocalRecipient.php index 694a1c6..bdd3319 100644 --- a/app/Rules/NotLocalRecipient.php +++ b/app/Rules/NotLocalRecipient.php @@ -27,16 +27,16 @@ class NotLocalRecipient implements Rule */ public function passes($attribute, $value) { - $emailDomain = Str::afterLast($value, '@'); + $emailDomain = strtolower(Str::afterLast($value, '@')); // Make sure the recipient domain is not added as a verified custom domain - if (Domain::whereNotNull('domain_verified_at')->pluck('domain')->contains(strtolower($emailDomain))) { + if (Domain::whereNotNull('domain_verified_at')->pluck('domain')->contains($emailDomain)) { return false; } $count = collect(config('anonaddy.all_domains')) ->filter(function ($domain) use ($emailDomain) { - return Str::endsWith(strtolower($emailDomain), $domain); + return $domain === $emailDomain || Str::endsWith($emailDomain, '.' . $domain); }) ->count();