diff --git a/src/UserEmail.php b/src/UserEmail.php index c232645b674..75541113a95 100644 --- a/src/UserEmail.php +++ b/src/UserEmail.php @@ -33,6 +33,8 @@ * --------------------------------------------------------------------- */ +use Glpi\Toolbox\Sanitizer; + /** * UserEmail class **/ @@ -274,7 +276,7 @@ public function prepareInputForUpdate($input) */ private function checkInputEmailValidity(array $input): bool { - return isset($input['email']) && !empty($input['email']) && GLPIMailer::validateAddress($input['email']); + return isset($input['email']) && !empty($input['email']) && GLPIMailer::validateAddress(Sanitizer::unsanitize($input['email'])); } diff --git a/tests/units/GLPIMailer.php b/tests/units/GLPIMailer.php index e343cd3e713..67578809cf2 100644 --- a/tests/units/GLPIMailer.php +++ b/tests/units/GLPIMailer.php @@ -67,6 +67,7 @@ protected function valideAddressProvider() ["test@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.dot", true], ["test@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.dot", false], ["test@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", true], + ["abcd'efgh@example.com", true], ]; }