diff --git a/lib/Service/ContactsIntegration.php b/lib/Service/ContactsIntegration.php index 47b749aa7a..908ad2ca13 100644 --- a/lib/Service/ContactsIntegration.php +++ b/lib/Service/ContactsIntegration.php @@ -66,6 +66,12 @@ public function getMatchingRecipient(string $userId, string $term): array { if ($e === '') { continue; } + + $mightBeValidEmail = filter_var($e, FILTER_VALIDATE_EMAIL); + if ($mightBeValidEmail === false) { + continue; + } + $receivers[] = [ 'id' => $id, // Show full name if possible or fall back to email