Problem/Motivation
The core mail validator service directly uses \Egulias\MailValidator\MailValidator class, without enforcing a specific interface to generalize the behaviour of such a service.
If you want to replace that service, you don't have a reference interface, you have to make sure you match exactly what the original MailValidator exposed if you don't want to break code using the mail validator service.
Use case for replacing the service:
The e-mail validator service does not only check syntax but also that the domain exists. Yo can go a step further and also attempt delivery to see if the account effectively exists. I already have this in contrib email validator module, but it's prompt to break due to lack of contract through an interface.
Other issues:
Egulias EmailValidator has changed its interface in version 2. Proxying it would provide backward compatibility.
Proposed resolution
Introduce a new interface to define what the mail validator service should look like, and make a bridge class to the Egulias implementation that implements that interface.
Remaining tasks
Doit.
User interface changes
None.
API changes
None.
Data model changes
None.