diff --git a/core/core.services.yml b/core/core.services.yml index f5ed5db..6ded521 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -1045,3 +1045,5 @@ services: arguments: ['@module_handler'] tags: - { name: mime_type_guesser } + email.validator: + class: Egulias\EmailValidator\EmailValidator diff --git a/core/includes/common.inc b/core/includes/common.inc index cbbff9f..1db96ff 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -34,7 +34,6 @@ use Drupal\Core\Template\Attribute; use Drupal\Core\Render\Element; use Drupal\Core\Session\AnonymousUserSession; -use Egulias\EmailValidator\EmailValidator; /** * @defgroup php_wrappers PHP wrapper functions @@ -353,7 +352,7 @@ function drupal_get_destination() { * TRUE if the address is in a valid format. */ function valid_email_address($mail) { - return (new EmailValidator())->isValid($mail); + return \Drupal::service('email.validator')->isValid($mail); } /**