Whitespaces before and after the @ should not be valid
Hello,
we are using your RFCValidation (Package version 2.1.25) through the laravel-framework validation and found a problem. Some customers entered their email address with a whitespace before or after the "@" separating the local and domain part. In our opinion this should not be valid according to RFC.
currently
[email protected] -> valid
name @domain.com -> valid
name@ domain.com -> valid
name @ domain.com -> valid
should be
[email protected] -> valid
name @domain.com -> invalid
name@ domain.com -> invalid
name @ domain.com -> invalid
kind regards Torben
Hello @torbenfischer As you can see in https://github.com/egulias/EmailValidator/blob/2.1.x/tests/EmailValidator/Validation/RFCValidationTest.php#L243 , that is the expected behaviour. The email is valid, albeit with warnings for a rare option where it might work (like https://github.com/egulias/EmailValidator/blob/2.1.x/tests/EmailValidator/Validation/RFCValidationTest.php#L103). You can use NoRFCWarningsValidation to invalidate these and other cases.
Hello @torbenfischer
you can use the "strict" option in laravel:
'email' => 'email:strict'
see https://laravel.com/docs/9.x/validation