- Issue created by @mmbk
- ๐ฉ๐ชGermany mmbk Meiรen
Sitenotes:
- Actually I don't understand the reason why it's not allowed to pass other validators into the `isValid` method.
- Maybe it's a good idea to make the validator configurable in the mailer settings?Differences between the validators found in my research:
RFCValidation:
Validates email addresses according to RFC 5322, including some edge cases and deprecated features, such as:
Quoted strings
Folding white space (FWS)
Comments
Space before the @ (technically valid per RFC but rarely supported)
This validator returns emails as valid even if they include unusual but technically RFC-compliant formats. It may emit warnings, which are important if you want to avoid deprecated or problematic formats.NoRFCWarningsValidation:
This is a stricter validator. It still uses RFC rules, but any format that triggers an RFC warningโlike a space before @โis considered invalid. #3061074: egulias/EmailValidator prior to 2.1.22 allows addresses with a space in the domain part โ suggests this was previously fixed for some other case.
- @annmarysruthy opened merge request.
- ๐ฎ๐ณIndia prabha1997
I have tested this locally and encountered the following issue:
Configuration: /var/www/html/core/phpunit.xml.dist F 1 / 1 (100%) Time: 00:10.017, Memory: 4.00 MB There was 1 failure: 1) Drupal\Tests\Core\Recipe\RecipeQuickStartTest::testQuickStartRecipeCommand Failed asserting that ' 0/16 [โโโโโโโโโโโโโโโโโโโโโโโโโโโโ]\n Installing Drupal\n \n 5/16 [โโโโโโโโโโโโโโโโโโโโโโโโโโโโ]\n Set up database\n \n 7/16 [โโโโโโโโโโโโโโโโโโโโโโโโโโโโ]\n Set up database\n \n 10/16 [โโโโโโโโโโโโโโโโโโโโโโโโโโโโ]\n Configure site\n \n In install.core.inc line 980:\n \n The email address <em class="placeholder">drupal@localhost</em> is not valid. Use the format user@example.com. \n The email address <em class="placeholder">admin@localhost</em> is not valid. Use the format user@example.com. \n \n \n quick-start [--langcode [LANGCODE]] [--password [PASSWORD]] [--site-name [SITE-NAME]] [--host [HOST]] [--port [PORT]] [-s|--suppress-login] [--] [<install-profile-or-recipe>]\n \n ' [UTF-8](length: 1108) contains "Congratulations, you installed Drupal!" [ASCII](length: 38). /var/www/html/core/tests/Drupal/Tests/Core/Recipe/RecipeQuickStartTest.php:119 FAILURES! Tests: 1, Assertions: 2, Failures: 1.
- ๐ฎ๐ณIndia prabha1997
Thank you for your feedback.
I've now added the following assertion to cover the invalid email case with a space:
$this->assertFalse($validator->isValid('example @example.com'));
Please let me know if any further changes are needed. - ๐บ๐ธUnited States smustgrave
Thnk a last step would be to get a CR written as this could be a behavior change for some