Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitespaces before and after the @ should not be valid #302

Open
torbenfischer opened this issue Aug 9, 2021 · 2 comments
Open

Whitespaces before and after the @ should not be valid #302

torbenfischer opened this issue Aug 9, 2021 · 2 comments

Comments

@torbenfischer
Copy link

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

name@domain.com -> valid
name @domain.com -> valid
name@ domain.com -> valid
name @ domain.com -> valid

should be

name@domain.com -> valid
name @domain.com -> invalid
name@ domain.com -> invalid
name @ domain.com -> invalid

kind regards
Torben

@egulias
Copy link
Owner

egulias commented Aug 12, 2021

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.

@bastian-schur
Copy link

Hello @torbenfischer

you can use the "strict" option in laravel:

'email' => 'email:strict'

see https://laravel.com/docs/9.x/validation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants